I am showing a jQuery overlay when users first visit a particular page
They have a radio button in the overlay that they can click to say they do not wish to see the notification again
I want to set a cookie that the user doesnt want to see the overlay again
Is it possible to set the cookie without refreshing the page?
I was going to make a ajax call back to the server and then set the cookie in the response headers but I guess they wont get set in an Ajax request/response?
Is it safe / OK to set the cookie purely from javascript? Or is that a bad idea?
any other options?
There is no reason that an AJAX call cannot set a cookie. It is basically just an HTTP request.
AJAX Requests Get And Set Cookies Like Any Other HTTP Request
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With