jquery dymaic loading of external script files before $(document).ready()
<p>Currently i have jqueryUI.js file referenced through the <code>&lt;script&gt;</code> tag<br/>
I have several $(document).ready() functions, which uses, jquery ui functions.</p>

<p>I am trying to load jqueryUI.js file dynamically using $.getScript</p>

<p>I tried the following code.</p>

<pre><code>Var scriptCntr = 0;
$(document.ready(function(){
    scriptCntr ++;
    $.getScript(path, function (data, textStatus) {
        scriptCntr --;
    });
    while(scriptCntr!=0){
    } 
});
</code></pre>

<p>on the top of the page.
The idea is to make the $(document).ready() wait till the file is downloaded. But the logic goes to the WaitLoop and stays there infinitely. And the file wouldnt download, unless all the $(document).ready() is executed. </p>

<p>Is there a way to download the jqueryUI.js file before the first $(document).ready() is executed?</p>

<p>Thanks in Advance.</p>
