[jQuery] [form] stop success message return if validation fails on server side
Hi all,
I am making a call to a php file which right at this minute has no
validation, all validation is been done by the jquery form plugin. I
post to the thanks file but if the validation (xss prevention soon to
be implemented) in the thanks fails I want to stop the processing of
the form i.e. stop the return of success.
How do I do this, any insight appreciated.
Code:
$("#myform").validate({
submitHandler: function(myform) {
jQuery(myform).ajaxSubmit({
type: "POST",
url: "thanks.php",
success: function() {
$('#contact_form').html("<div id='message'></div>");
$('#message').html("<h2>Contact Form Submitted!</h2>")
.append("We will be in touch soon.
")
.hide()
.fadeIn(1500, function() {
$('#message').append("<img id='checkmark' src='/
images/check.png' />");
});
}
});
}