i use the jquery validation plugin to validate form before submit in submitHandler i use ajax request to post the form with ajax before i used .ajax to send the request but
Try to invert the functions:
jQuery('#form_id').ajaxForm({
beforeSubmit: function() {
jQuery("#form_id").validate({
rules: {
first_name: "required",
last_name: "required"
},
messages: {
first_name: "Required",
last_name: "Required"
}
});
return jQuery('#form_id').valid();
},
success: function(resp) {
jQuery('#resp').html(resp).fadeIn('fast');
}
});
Where #resp
is the ID that will receive the HTML generated from the file your #form_id
posted