Skip to content

Instantly share code, notes, and snippets.

@erinwan
Created November 15, 2015 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erinwan/e0191ce68e1742f5c00b to your computer and use it in GitHub Desktop.
Save erinwan/e0191ce68e1742f5c00b to your computer and use it in GitHub Desktop.
ajax handle form error
$("div.errorlist").remove();
//console.log(response.hasOwnProperty("errors"));
if (response.hasOwnProperty("errors")) {
//console.log(response["errors"]);
$commentInputFormRightDiv = $("li[class='post-item post-comment active'][data-post-id='" + postID + "'] div.row.post-comment-submit div.post-div-right");
for (var key in response["errors"]) {
$commentInputFormRightDiv.append($("<div>").html(response["errors"][key]).addClass("errorlist"));
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment