Possible Duplicate:
I have included jQuery this way:
function loadScript(loc){
var head = document.getElementsByTagName('head')[0];
var file = document.createElement('script');
file.src = loc;
file.type = "text/javascript";
head.appendChild(file)
}
loadScript("js/jquery.js")
Now the next script should be loaded the same way. But if it is loaded after the last line, I can't use jQuery, because it may not be finished with loading. So how to check, if the loading of jQuery is done? Can I do something like this?:
while (typeof jQuery == 'undefined')
{
wait...
}