Reputation: 2543
If I return a cookie with a response which is triggered by an ajax request, would the browser save the cookie?
Upvotes: 5
Views: 495
Reputation: 17032
Yes, the browser will save the cookie you've created in the ajax request - it doesn't matter if your request was via ajax or you've reloaded the page. It's still a REQUEST :)
Upvotes: 2
Reputation: 7389
yes, from: http://www.w3.org/TR/XMLHttpRequest/
If the user agent supports HTTP State Management it should persist, discard and send cookies (as received in the Set-Cookie response header, and sent in the Cookie header) as applicable. [COOKIES]
Upvotes: 5