Transferring Cookies to the Server

I am writing a single page application with CanJS. For one of the models, every time I save a new item, the application sends a regular POST request. However, there is a specific cookie that is returned in the HTTP response, which I would like to send back to the server for GET requests when retrieving the item.

+4
source share
1 answer

All cookies related to the application are automatically sent to the server in the request header. Make sure that the cookie you want to send has the same application .

This can be verified by viewing your browser’s cookies. Make sure the cookie you want to send has the Domain as the name of your application. Like all stackoverflow cookies, the domain value will be .stackoverflow.com

You can refer to this guide, which talks about creating and setting a cookie in JavaScript: http://www.w3schools.com/js/js_cookies.asp

+3
source

All Articles