PDA

View Full Version : Global Variable across multiple files



kulshreshtha.s
10 Jul 2011, 3:00 PM
Hi ,

I have few global variables like userID and FirstName, Which I have mentioned in index.html :



var userID = 0;
Var firstName = ' ' ;

Now In one of the views, I have ajax request to authenticate the user and return the userid & firsname.
I am a new bee to javascript, What is the best way to assign the userID and firstname to the above global variables. If I try to access the global variables in some different view, I'm getting the default value.

In the index.html the call to JS files is sequential.

Thanks.