By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,944 Members | 1,611 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,944 IT Pros & Developers. It's quick & easy.

how to avoid update of a js variable

P: 1
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
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,639
not unless you save that outside the realm of JS (e.g. cookies or using the sessionStorage)
Sep 8 '11 #2

P: 246
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.