Global variable life in Javascript - destroyed on a reload?

Posted by Paul Nathan on Stack Overflow See other posts from Stack Overflow or by Paul Nathan
Published on 2010-03-24T20:58:26Z Indexed on 2010/03/24 21:03 UTC
Read the original article Hit count: 349

(I am learning Javascript)

Problem: A page I am working on has 2 views, a data entry view with a textbox and a data rendering view. There is a a href src="currentpage#" link that switches between the 2 views. In order to transmit data from view to view, the javascript parses it from the current HTML and pushes it into the correct form for the other view. This is ugly and I want to refactor it out, ideally into some sort of global where it can be neatly rendered down into the view on command (I'm refactoring the code base to a point where I can AJAX it from a server).

However, I am not certain about scoping rules and variable life in JS.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about global-variables