Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does jQuery send cookies in a post?

I want to know if, when I make a $.post(...) with jQuery, is any cookie sent to the server in the post request?

Thanks!

like image 248
Rodrigo Amaya Avatar asked Jun 24 '09 22:06

Rodrigo Amaya


People also ask

Do AJAX requests send cookies?

Basically, ajax request as well as synchronous request sends your document cookies automatically.

How do I send cookies in a post request?

To send cookies to the server, you need to add the "Cookie: name=value" header to your request. To send multiple Cookies in one cookie header, you can separate them with semicolons. In this Send Cookies example, we are sending HTTP cookies to the ReqBin echo URL.

What does post do in jquery?

post() method loads data from the server using a HTTP POST request.

Are JavaScript cookies sent to server?

The data stored in the cookie is created by the server when it processes a request from the client. This data is tagged with an identifier that is unique to you and your computer. The browser sends cookies back to the server with each subsequent request.


1 Answers

Cookies are sent with Ajax requests.

When the HTTPOnly flag is set for a cookie, this cookie is hidden from client-side scripts, but the cookie is still sent with Ajax requests.

like image 167
Ayman Hourieh Avatar answered Sep 21 '22 20:09

Ayman Hourieh