Hello,
I'm using the following bit of script to load another one:
$.getScript("CAGScript.js", function () {
try {
CAGinit();
} catch(err) {
console.log(err);
}
});
The idea is that $.getScript loads the script, then executes the callback when it's done. CAGInit()
is a function that lives in CAGScript.js
.
The problem is that roughly half the time, CAGInit()
doesn't fire (in any browser). Logging to the Firebug console reports that it's not defined. The rest of the time it works perfectly.
Does anyone have any ideas what I'm doing wrong?
Thanks.