Reputation: 11309
I have a drop-down on my site that I want visible to any first-time visitor, but if the user closes it, then I want to keep it closed on next visit for the same user.
Can I do this just with jQuery or do I need to pass the state back to the server (via Ajax?) and use server's session capabilities?
Thank you
Upvotes: 0
Views: 359
Reputation: 490647
You can use cookies (to store the preference), or if you have authentication on your site, you could POST
back via AJAX and update your users preferences (this will have the advantage of not relying on cookies expiring/being deleted).
Upvotes: 1
Reputation: 17772
You need to use cookies, it can be achieved with plain javascript. This is a nice resource for learning to deal with cookies.
Upvotes: 0