通过设置ajaxError ajaxComplete可以或者ajax 异常
$(document).ajaxError(function(event, jqxhr, settings, exception) {
window.console && console.log(exception);
alert('An unexpected error has occurred. Please contact support.\nError requesting page ' + settings.url);
});
$(document).ajaxComplete(function(event, xhr, settings) {
if (xhr.responseText == "AJAX_UNEXPECTED_EXCEPTION") {
alert('An error has occurred. Please contact support.');
}
});