I’m working with a jQuery plugin (ajax form), I try to implement something like this:
$("#MyFormID").ajaxForm({
dataType: "json",
resetForm: true,
beforeSubmit: function() {
//validateData returns boolean
if (validateData()) {
// continue submit
} else {
//cancel submit
}
},
success: function(json) {
//show success notification
}
});
is there a way to stop the ajax from submiting the form?
on beeforesubmit function maybe?
You can use
return false;inbeforeSubmitfunction to prevent form submission.Source: http://jquery.malsup.com/form/#options-object