设置ajaxError

通过设置ajaxErrorajaxComplete可以或者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.');
	}
});

相关推荐