How can I set cookies in PHP server-side with Ajax and read cookies in the real-time with JavaScript?
Example: After pressed ok button, the client-side will call Ajax and Ajax will call to PHP server-side to collect data. It will also assign a value into cookies in PHP server-side while it’s getting the data. At the sametime, I want to read the assigned value cookies with another function in real-time(the function will call from the Ajax when it starts calling to PHP server) and display the cookie’s value on the client-side.
I tried this many time, but seem like the function can only get the updated cookie’s value after the Ajax process is completed.
How would you be able to read a cookie on the client before it has arrived there?
To me your question sounds like you try to read the cookie right in step 1. This won’t be possible.
If that’s not what you are trying to do, then your question needs some re-wording. 🙂