javascript callback after loop
<p>Iv'e just started a new Wordpress blog and i have started to build the JavaScript base!</p>

<p>the issue im having is that i have a fucntion that loops several variables and includes the required JS libraries, what i need to do is execute the callback when the loop is finished!</p>

<p>Heres my code!</p>

<pre><code>var Utilities = {
    Log : function(item)
    {
        if(console &amp;&amp; typeof console.log == 'function')
        {
            //Chrome
            console.log(item);
        }
    },
    LoadLibraries : function(callback)
    {
        $.each(Wordpress.required,function(i,val){
            //Load the JS
            $.getScript(Wordpress.theme_root + '/js/plugins/' + val + '/' + val + '.js',function(){ //  %/js/plugins/%/%.js
                Utilities.Log('library Loaded: ' + val);
            });
        });
        callback();
    }
}
</code></pre>

<p>And the usage is like so!</p>

<pre><code>Utilities.LoadLibraries(function(){
    Utilities.Log('All loaded');
});
</code></pre>

<p>Above you see the execution of <code>callback()</code> witch is being executed before the files are in the dom! i need this called at the end of every library inclusion!</p>
