victorjonsson / jQuery-Form-Validator

[DISCONTINUED] jQuery plugin that makes it easy to validate user input while keeping your HTML markup clean from javascript code.
973 stars 477 forks source link

Unable to validate form on submit by jquery via ajax #713

Open azadhussain16 opened 5 years ago

azadhussain16 commented 5 years ago

Ho can I prevent form submission if there is any invalid fields in the form I am submiting the form on submit by ajax.

victorjonsson commented 5 years ago

Something like this

$.validate({
    form : '#registration-form',
    modules : 'security',
    onSuccess : function($form) {
      // send form with ajax
      myAjaxFunc($form);
      return false; // Will stop submission of the form
    }
});