ajax跨域请求时,sessionId不一样,导致无法记住登录状态

【转】 ajax跨域请求时,sessionId不一致问题 

解决方案:

js的ajax中,设置

xhrFields:{

      withCredentials : true

}

$.ajax({
    url: '',
    type: 'POST',
 
    xhrFields:{
        withCredentials:true
    },

    data: {
        username:userName
    },
    success: function(respon){
       
    },
    error: function(){
        
    }
});

猜你喜欢

转载自blog.csdn.net/Tdh5258/article/details/82597158