Skip to content

Commit d14bf08

Browse files
committed
If an ajax error occurs and we have an onFailure handler defined, call it
1 parent 99ea7d3 commit d14bf08

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)) {
@@ -1404,7 +1408,11 @@
14041408
options: options,
14051409
beforeSend: function() {},
14061410
error: function(data, transport) {
1407-
methods._ajaxError(data, transport);
1411+
if (options.onFailure) {
1412+
options.onFailure(data, transport);
1413+
} else {
1414+
methods._ajaxError(data, transport);
1415+
}
14081416
},
14091417
success: function(json) {
14101418

0 commit comments

Comments
 (0)