Is it possible to call in a .js file synchronously and then use it immediately afterward?
Ironically, I have what you want, but want something closer to what you had.
I am loading things in dynamically and asynchronously, but with an load callback like so (using dojo and xmlhtpprequest)
dojo.xhrGet({
url: 'getCode.php',
handleAs: "javascript",
content : {
module : 'my.js'
},
load: function() {
myFunc1('blarg');
},
error: function(errorMessage) {
console.error(errorMessage);
}
});
For a more detailed explanation, see here
The problem is that somewhere along the line the code gets evaled, and if there's anything wrong with your code, the console.error(errorMessage); statement will indicate the line where eval() is, not the actual error. This is SUCH a big problem that I am actually trying to convert back to statements (see here.