Currently to achieve ajax submit and validation at the same time. I\'m using custom function like:
$(\'.edit_form\').submit(function (e) {
e.preventD
Use beforeSubmit event instead of submit, the beforeSubmit will only be triggered once the form passes the validation.
$('form').on('beforeSubmit', function(e) {
var form = $(this);
var formData = form.serialize();
$.ajax({
url: form.attr("action"),
type: form.attr("method"),
data: formData,
success: function (data) {
...
},
error: function () {
alert("Something went wrong");
}
});
}).on('submit', function(e){
e.preventDefault();
});