I’m using jQuery validate plugin that has a callback submitHandler. In that callback if it returns false, it aborts the submit and if it returns true it submits using the post method.
$("#collection_form").validate({
submitHandler: function(form) {
pre_ajax_submit(function (pre_ajax_return) {
if (pre_ajax_return == 'non_ajax') {
//something
} else {
//other
}
});
}
});
So my question is: I have a function in the callback pre_ajax_submit()
. How can I have a function return true or false in the main callback. I want to achieve the same result as this:
$("#collection_form").validate({
submitHandler: function(form) {
return true;
}
});