处理登录时,AJAX的状态码无权限情况

$.ajaxSetup({
complete: function(XMLHttpRequest, textStatus) {

},
error:function(jqXHR,textStatus,errorThrown){
switch(jqXHR.status){
case(500):
alert('服务器系统内部错误');
break;
case(401):
alert('登陆超时,请重新登陆');
localStorage.removeItem("access_token");
localStorage.removeItem("refresh_token");
window.location.href="login.html";
break;
case(403):
alert("无权限执行此操作");
break;
case(408):
alert("请求超时");
break;
}
}
});
原文地址:https://www.cnblogs.com/chenweida/p/11429704.html