项目场景:
ajax请求本地环境,个别环境可能出现请求返回400 BadRequest
问题描述
个别 有时会出现
原因分析:
经过对比发现缺了set_cookie
解决方案:
请求种添加如下内容
xhrFields: {//设置withCredentials 允许带Cookie
withCredentials: true
},
例子:
type: ‘post’,
data: data,
xhrFields: {//设置withCredentials 允许带Cookie
withCredentials: true
},
async: false,
然后再去了,在请求也正常,请前端解释下