easyui jquery ajax的全局设置token



//jquery全局配置
$.ajaxSetup({
dataType: "json",
cache: false,
headers: {
"token": token
},
// xhrFields: {
// withCredentials: true
// },
complete: function(xhr) {
//token过期,则跳转到登录页面
if(xhr.responseJSON.code == 401){
parent.location.href = base.url.appname + 'login.html';
}
}
});


发布了201 篇原创文章 · 获赞 5 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/mutourenoo/article/details/84921154