Skip to content

Commit

Permalink
Moving the beforeSubmit event above where the options are appended to…
Browse files Browse the repository at this point in the history
… the URL so you can change the options before submit.
  • Loading branch information
breath20 committed Jul 24, 2016
1 parent 6bf24a5 commit eddc9ea
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions jquery.form.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,20 @@ $.fn.ajaxSubmit = function(options) {
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);
if (options.data) {
options.extraData = options.data;
qx = $.param(options.data, 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 eddc9ea

Please # to comment.