前端需要xhr.withCredentials = true 来标识传输cookie 服务端配置 需要设置 Access-Control-Allow-Credentials:true 才能获得前端的cookie 前端 12345678910111213 $.ajax({ url: 'http://10.50.101.79:3000/o2o-web/orderInfoCache', data: data4, type: 'POST', crossDomain: true, xhrFields: {withCredentials: true}, success: function (data) { console.log(data) }, error: function (err) { console.log(err) }}) 后台 1234 app.use(cors({ // origin: 'http://weixin.mama100.cn', credentials: true})); 赞微海报分享
近期评论