Could you post the code on how you use the variable?

Basically what I did is just I call the function that has an argument for the variable in html script and pass the variable to it.