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

  

相关文章:

  • 2021-05-19
  • 2022-12-23
  • 2021-06-13
  • 2021-12-27
  • 2022-01-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-14
  • 2021-12-17
  • 2022-03-01
  • 2022-12-23
  • 2022-01-13
相关资源
相似解决方案