标签:res 登录页面 complete header function var oca 全局 ajax
var token = localStorage.getItem("token");
$.ajaxSetup({
dataType: "json",
cache: false,
headers: {
"token": token
},
xhrFields: {
withCredentials: true
},
complete: function(xhr) {
//token过期,则跳转到登录页面
if(xhr.responseJSON.code == 401){
parent.location.href = baseURL + ‘login.html‘;
}
}
});
标签:res 登录页面 complete header function var oca 全局 ajax
原文地址:https://www.cnblogs.com/randomlee/p/10080896.html