Here is my JS File:
function loadScripts(){
var scripts = ['a.js', 'b.js', 'c.js'];
for (i=0; i<scripts.length; i++){
var script = document.createElement('script');
script.src = scripts[i];
head.insertBefore(script, head.firstChild);
}
};
function Formatter(){
setTimeout(function(){loadScripts()},1000);
this.instantiate = function(){
return this;
};
this.func1 = function(){
...
};
this.func2 = function(){
...
};
};
func2 uses a variable that is inside the scripts to be loaded and it is throwing an error saying the variable is not defined. I am unable to stop the processing to get the scripts loaded. How do I do it? The function Formatter() is invoked from JSPs and then instantiate() method is called.