Best way to store data clientside
I would like to store data temporarily on clientside. What is the best way to do this? I only want to store a small amount, which will probably just be an integer.
It does not matter if this data is lost when the browser is closed, if the session is closes, of the user navigates to another page etc etc. I just need it so I can access the value later on while the user is still on that page. The data needs to be stored when the page loads.
Is it best to use a hidden input field, cookie, jquery.data (don't really know much about this so this may not fit in here), or some other method?
To be more specific, the user will be selecting an item from the database, s/he will edit the data sent back, the id will also be se开发者_StackOverflownt back, then when they click save, i need to know the id so the edited data can be saved back to the database updating the row based on the id originally selected.
Hidden field is fine, and if you're submitting the data as part of a form, it's probably the preferred option.
If the value is required
on current page
then Hidden Field
is Best
Option out of hidden input field, cookie, jquery.data
精彩评论