i'm using jQuery validate() plugin to validate a form. it does the validation but how do i perform a set of function if there are no errors?
i've tried this
$(document).ready(function() {
$('form').validate({
submitHandler: function(form) {
$.post('php/contact.php', {
name: $('form #name').val(),
email: $('form #email').val(),
comments: $('form #comments').val() },
function(data) {
if(data.success) {
alert('thank you');
}
else {
alert('error');
}
}, 'json');
form.submit();
}
});
});
The form validates but i'm not getting data.success as true from php now. any ideas?