tlacaelelrl — 2011-04-18T11:01:05-04:00 — #1
Is there a way to keep a variable value on page refresh, if I have
but then a users does somethibng that makes that value become
and then the page is refreshed, is there a way to keep that value of 4 for the x variable or it will always reset to the original value?
hurrakan — 2011-04-18T11:08:53-04:00 — #2
You have these options (in order of preference):
- Sessions (server side)
- Cookies (client side)
- URL Query String
tlacaelelrl — 2011-04-18T11:18:53-04:00 — #3
well, I been trying the url one but can´t seem to get it right, I am trying it like this but oviously is not working, can you help me on it?
var enable_button=location.href+'?enable_button=enable_button' || 0;
I did the || 0 because I want it to assign the value 0 to it when the page is first loaded
hurrakan — 2011-04-18T11:24:05-04:00 — #4
You should really use Sessions because the others can be manipulated by the user.
tlacaelelrl — 2011-04-18T11:48:50-04:00 — #5
Thank you for your help, I started rerading some posts about the sessions and found a recommendation to store the value in a hidden field, and that worked fine for what I am trying to do