ajax全域性報錯處理
阿新 • • 發佈:2018-12-22
$(document).ajaxError(function (e, xhr) {
setTimeout(function () {
if (xhr.status === 401) {
window.location.reload();
}
else if (xhr.status === 410) {
$(".web-loading").fadeOut(800);
$("#NoAccessModal").modal();
}
else if (xhr.status === 404){
window.location.href = “/Home/Error404”;
}
else if (xhr.status === 429) {
window.location.href = “/Home/RobortLike”;
}
else if (xhr.status === 408 || xhr.status === 0 || xhr.status === 200 || xhr.status === 501) {
}
else {
window.location.href = “/Home/Error”
- (xhr.getResponseHeader(“Gbi-Churin-Debugger-Mode”) ? “?previousContextId=” + xhr.getResponseHeader(“Gbi-Churin-HttpContext-Id”) : “”);
}
}, 0);
});