`

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';
        }
    }
});


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics