how to avoid update of a js variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Reds
    New Member
    • Sep 2011
    • 1

    how to avoid update of a js variable

    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?
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    not unless you save that outside the realm of JS (e.g. cookies or using the sessionStorage)

    Comment

    • Samishii23
      New Member
      • Sep 2009
      • 246

      #3
      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

      Comment

      Working...