I am having a strange problem with global variables disappearing on me. Here is some stripped down semi-pseudo-code:
var globy = 99;
jQuery.get("file", function(){
check();
})
function check(){
main();
}
function main(){
forloop
whileloop
forloop
while(test()){}
}
function test(){
//globy causes a reference error here
}
That should explain the code structure. All the way up to the test() function “globy” is fine but suddenly inside test() all global variables disappear. What the heck?
If you are wrapping everything in a
$(document).ready()but have yourtest()function outside of the document ready you will have a scoping issue.Besides that it will be hard to say without the real js.