Skip to content

Commit

Permalink
Merge pull request #506 from amartin916/master
Browse files Browse the repository at this point in the history
Moving the beforeSubmit event above where the options are appended to url
  • Loading branch information
kevindb committed Feb 20, 2017
2 parents bf629b2 + eddc9ea commit 3548f3a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions jquery.form.js
Expand Up @@ -165,6 +165,12 @@ $.fn.ajaxSubmit = function(options, data, dataType, onSuccess) {
traditional = $.ajaxSettings.traditional;
}

// give pre-submit callback an opportunity to abort the submit
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSubmit callback');
return this;
}

var elements = [];
var qx, a = this.formToArray(options.semantic, elements, options.filtering);
if (options.data) {
Expand All @@ -173,11 +179,7 @@ $.fn.ajaxSubmit = function(options, data, dataType, onSuccess) {
qx = $.param(optionsData, traditional);
}

// give pre-submit callback an opportunity to abort the submit
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSubmit callback');
return this;
}


// fire vetoable 'validate' event
this.trigger('form-submit-validate', [a, this, options, veto]);
Expand Down

0 comments on commit 3548f3a

Please sign in to comment.