同様のことがすでにstackoverflowで議論されているようですが、まったく同じものは見つかりませんでした。クロスドメインのPOSTリクエストはクッキーを送信していませんAjax Jquery
CORS(クロスオリジンリソース共有)でCookieを送信しようとしていますが、機能しません。
これは私のコードです。
$.ajax(
{
type: "POST",
url: "http://example.com/api/getlist.json",
dataType: 'json',
xhrFields: {
withCredentials: true
},
crossDomain: true,
beforeSend: function(xhr) {
xhr.setRequestHeader("Cookie", "session=xxxyyyzzz");
},
success: function(){
alert('success');
},
error: function (xhr) {
alert(xhr.responseText);
}
}
);
リクエストヘッダーにこのCookieが表示されません。
http://stackoverflow.com/questions/3342140/cross-domain-cookies Schuhmann @Justin –