I’m working on a travel website. I’m looking for a function that allows my users to click a hotel and save their selection to a “list” on the sidebar.
I want it to function like a cart so that the list never erases and so that you can see the selection until you are ready to print everything out.
Any help/suggestions are appreciated.
Thanks!
If your users are going to be clicking around to a lot of pages, it will be a real challenge to keep sending this growing list around from page to page on the client side. I would recommend that you consider a different approach. One is cookies, and another is session state.
If you are using server-side code, it would help us to know what language you are using so that we can give you some more ideas.
I would suggesting using AJAX to pass the selection to the backend. If you want this to persist across multiple sessions you’re going to want to save it to a database so they can come back later.
http://api.jquery.com/jQuery.ajax/
Use cookies if you don’t want to use php.
http://www.w3schools.com/js/js_cookies.asp
has a good example of how to use cookies in javascript.
I recommend using “My favourite posts” wordpress plugin for this kind of job.