I\'m making a comment feature for my website and need to make it so that after the person submits a comment (and it contains errors), it will show the error without refreshi
For basic validations like empty fields or length of input box you can use jQuery validate plugin -- http://jquery.bassistance.de/validate/demo/ or write something of your own.
You can use jQuery for a better AJAX/error handling. Check the documentation for jQuery AJAX here -- http://api.jquery.com/jQuery.ajax/
$.ajax({
url: "test.html", //URL to send the request
success: function() {
//do something. This is fired when your response is successful
},
error: function() {
//highlight the field that has error or do something else here.
}
);
Hope this helps :)