weixin_33694172 2018-01-29 17:28 采纳率: 0%
浏览 26

Ajax调用中的cookie

I have this setting:

specifically, I'm using jquery and doing a $.ajax("https://baz.example.com/.../resource.json")

I expected the ajax call to send the cookie to the server, but nothing is sent. If I add the option xhrFields: { withCredentials: true } to the jquery method I succesfully see the cookie sent, but I was expecting that this was not necessary.

Why is foo.bar.example.com a different domain from baz.example.com? Why isn't the cookie shared? if I do a "manual" get opening the JSON url with the browser from a different tab I see the cookie is sent.

  • 写回答

0条回答 默认 最新

    报告相同问题?