mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
Fix #2108 use error callback function if AJAX transmission fails for any reason
This commit is contained in:
parent
bd8fe996e1
commit
907750ff79
1 changed files with 10 additions and 1 deletions
|
|
@ -247,7 +247,7 @@
|
|||
});
|
||||
}
|
||||
// Should not display the error message when the callback function returns false.
|
||||
if ($.isFunction(callback_error) && callback_error(data) === false) {
|
||||
if ($.isFunction(callback_error) && callback_error(data, xhr) === false) {
|
||||
return;
|
||||
}
|
||||
if(data.error == -1 && data.message == "admin.msg_is_not_administrator") {
|
||||
|
|
@ -294,6 +294,15 @@
|
|||
waiting_obj.hide().trigger("cancel_confirm");
|
||||
var error_info;
|
||||
|
||||
// If a callback function is defined, call it and check if it returns false.
|
||||
if ($.isFunction(callback_error)) {
|
||||
var data = { error: -3, message: textStatus };
|
||||
if (callback_error(data, xhr) === false) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, display a simple alert dialog.
|
||||
if ($(".x_modal-body").size()) {
|
||||
error_info = xhr.status + " " + xhr.statusText + " (" + textStatus + ")" + "<br><br><pre>" + xhr.responseText + "</pre>";
|
||||
alert("AJAX communication error while requesting " + params.module + "." + params.act + "<br><br>" + error_info);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue