PHPology is a collective of highly skilled, award winning, web gurus.
Contact Raj on 07985 467 213 or email [email protected]
jQuery Validation with AJAX
Quick code sample on how to use jQuery Validation with AJAX based on a successful page validation...
//prepare the post request for the newsletter form
jQuery('form#form-newsletter').validate({
submitHandler: function(form) {
jQuery.ajax({
url: '/home',
type: 'post',
dataType: 'json',
data: jQuery('form#form-newsletter').serialize(),
success: function(data) {
jQuery('.contact_form').hide();
jQuery('.newsletter_success').show();
}
});
return false;
},
errorElement: "label"
});
