设置全局ajax超时处理

This commit is contained in:
RuoYi
2018-05-22 22:46:40 +08:00
parent 95fc2f2d83
commit 4de464dc2d
2 changed files with 13 additions and 1 deletions

View File

@ -167,3 +167,16 @@ function createMenuItem(dataUrl, menuName) {
}
return false;
}
//设置全局ajax超时处理
$.ajaxSetup({
complete: function(XMLHttpRequest, textStatus) {
if (textStatus == "parsererror") {
$.modalConfirm("登陆超时!请重新登陆!", function() {
window.location.href = ctx + "login";
})
} else if (textStatus == "error") {
$.modalAlert("请求超时!请稍后再试!", 'warning');
}
}
});