...

View Full Version : Problems loading module



dragon6158
06-20-2008, 05:48 PM
Hello,
I am using the following to load modules in a job aid system that we are working on:



var continueNow = 0;
$.get("modules/footer.module", function(html) {alert('3');$("div#footer").append(html);});
$.get("modules/sample.module", function(html) {alert('1'); $("div#content").append(html);alert('2');continueNow = testMe();alert(continueNow);});
if(continueNow){alert('hi');
/*if (addModules()){
if (setup()){
thickbox()
}
}*/
};
alert(continueNow);
function testMe(){alert('hello');
return(1);
};


When I run it, the alert just before the line function testMe() fires then the alert in the first get statement followed by the first 2 alerts in the second get statement followed by the alert in the function followed by the last alert in the second get statement. If I hard-code continueNow to be 1, the alert in the if statement is the first to fire by the rest in the same order. How can I make the if statment wait until the get's finish so I can process the information in the get's? My coworker says that this is caused by a multithreading issue.

Thanks,
Don

NancyJ
06-21-2008, 10:51 AM
Anything you want processed after your $.get is completed should be in your callback function.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum