I\'m using the following bit of script to load another one:
$.getScript(\"CAGScript.js\", function () {
try {
CAGinit();
} catch(err) {
I think you can start by checking testStatus of the callback function to make sure that the script was really loaded. Callback function has two parameters, more defails on those you can find on jQuery Docs
$.getScript("CAGScript.js", function (data, textStatus) {
if (textStatus === "success") {
try {
CAGinit();
} catch(err) {
console.log(err);
}
} else {
console.log("script not loaded");
}
});