Skip to content

Commit 95f7204

Browse files
committed
Merge pull request posabsolute#651 from wwadge/master
If an ajax error occurs and we have an onFailure handler defined, call it
2 parents 4887fd2 + d14bf08 commit 95f7204

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

js/jquery.validationEngine.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,11 @@
446446
return options.onBeforeAjaxFormValidation(form, options);
447447
},
448448
error: function(data, transport) {
449-
methods._ajaxError(data, transport);
449+
if (options.onFailure) {
450+
options.onFailure(data, transport);
451+
} else {
452+
methods._ajaxError(data, transport);
453+
}
450454
},
451455
success: function(json) {
452456
if ((dataType == "json") && (json !== true)) {
@@ -1407,7 +1411,11 @@
14071411
options: options,
14081412
beforeSend: function() {},
14091413
error: function(data, transport) {
1410-
methods._ajaxError(data, transport);
1414+
if (options.onFailure) {
1415+
options.onFailure(data, transport);
1416+
} else {
1417+
methods._ajaxError(data, transport);
1418+
}
14111419
},
14121420
success: function(json) {
14131421

0 commit comments

Comments
 (0)