Leonardo
Leonardo

Reputation: 11391

Ajax 'GET' http method behavior

When i send a HTTP GET via ajax, does it includes propers cookies? or cookies goes in the request only when Method is POST?

Upvotes: 0

Views: 40

Answers (2)

aludvigsen
aludvigsen

Reputation: 5981

A get request should send cookies.

but
AJAX calls only send Cookies if the url you're calling is on the same domain as your calling script.

Read more in this SO answer

notice
localhost:3000 and localhost:3001 is not the same domain and treated as cross domain, so no cookies will be sent. (source)

Upvotes: 1

Barmar
Barmar

Reputation: 780974

It should send cookies with either type of request, just like the browser does when following links or submitting a form.

Upvotes: 0

Related Questions