how to pass in a reference to a string in javascript?
- by ijjo
maybe a closure is my solution? not exactly sure how to pull it off though.
the code is set up like so:
var globalVar = '';
var globalVar2 = '';
function func()
{
if (condition)
func2(globalVar)
else
func2(globalVar2)
}
in func2() i cache some HTML in a main container into the appropriate global variable that i pass to it. basically i have a main container that holds different pages depending on what tab they choose. for performance i want to cache the page into global vars so i need to know what tab is active to figure out which global var to assign the html to.