Is the callback on jQuery's getScript() unreliable or am I doing something wrong?
<p>I'm using the following bit of script to load another one:</p>

<pre><code>$.getScript("CAGScript.js", function () {
    try {
        CAGinit();
    } catch(err) {
        console.log(err);
    }
});
</code></pre>

<p>The idea is that $.getScript loads the script, then executes the callback when it's done. <code>CAGInit()</code> is a function that lives in <code>CAGScript.js</code>.</p>

<p>The problem is that roughly half the time, <code>CAGInit()</code> 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.</p>

<p>Does anyone have any ideas what I'm doing wrong?</p>

<p>Thanks.</p>
