Skip to content

Commit 3548f3a

Browse files
authored
Merge pull request #506 from amartin916/master
Moving the beforeSubmit event above where the options are appended to url
2 parents bf629b2 + eddc9ea commit 3548f3a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

jquery.form.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ $.fn.ajaxSubmit = function(options, data, dataType, onSuccess) {
165165
traditional = $.ajaxSettings.traditional;
166166
}
167167

168+
// give pre-submit callback an opportunity to abort the submit
169+
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
170+
log('ajaxSubmit: submit aborted via beforeSubmit callback');
171+
return this;
172+
}
173+
168174
var elements = [];
169175
var qx, a = this.formToArray(options.semantic, elements, options.filtering);
170176
if (options.data) {
@@ -173,11 +179,7 @@ $.fn.ajaxSubmit = function(options, data, dataType, onSuccess) {
173179
qx = $.param(optionsData, traditional);
174180
}
175181

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

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

0 commit comments

Comments
 (0)