469,344 Members | 6,266 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,344 developers. It's quick & easy.

how to avoid update of a js variable

1
Hi,
i m using a js variable to store a data from a jsp page.But when page is refreshed, the date will be updated.
I want the data available even after page refresh. Is there a way to do this?
Sep 8 '11 #1
2 1151
Dormilich
8,652 Expert Mod 8TB
not unless you save that outside the realm of JS (e.g. cookies or using the sessionStorage)
Sep 8 '11 #2
Samishii23
246 100+
One possible way is to have the pages load through Ajax.
For example load the initial page then have ajax call data and load a "Main" container with the page.

jQuery uses easy ajax calls, and can even get specific chunks of an HTML page. Like loading a page with a div with the id "stuff" and it'll return only the html of that div.

Other then that its not really possible unless like Dorm said to use cookies or session storage. Cause HTML pages are static documents and were not meant to be Dynamic, until JS, then Ajax was born.

Good luck
Sep 13 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Igor | last post: by
1 post views Thread by Wing | last post: by
3 posts views Thread by Phil Townsend | last post: by
reply views Thread by =?Utf-8?B?bWFydGluMQ==?= | last post: by
2 posts views Thread by Kevin | last post: by
1 post views Thread by donken | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.