Ajax跨域请求COOKIE无法带上 怎么搞?

jquery的ajax的post方法请求:

$.ajax({
type: “POST”,
url: “http://xxx.com/api/test”,
dataType: ‘jsonp’,
xhrFields: {
withCredentials: true
},
crossDomain: true,
success:function(){
},
error:function(){
}
})

服务器端设置:

header(“Access-Control-Allow-Credentials: true”);

header(“Access-Control-Allow-Origin: http://www.xxx.com”);

发表评论

电子邮件地址不会被公开。 必填项已用*标注