In php, I'm wondering how the setcookie() function can modify the client side cookie when I use a separated way between client and server to communicate(like only by ajax call and return json data). In this case, does a call to this function in server side automatically send back a new http header to client? otherwise how would the function call modify cookie data at client side?
Asked
Active
Viewed 36 times
1 Answers
0
setcookie() function works because when your php code executing on server side it can save the values to the cookie, you only need ajax here if you wish to modify that cookie without refreshing the page. And after the page reloads, again the same cycle will happens and it can modify the cookie.

Sarvagna Mehta
- 334
- 3
- 16