Jquery OnLoad - weird behaviour
<p>I have this function:</p>

<pre><code>$("#loading_button").click(function(){
    (function() {
        var s = document.createElement("script");
       s.type = "text/javascript";
        s.async = true;
        s.src = '//some_src/';
        var x = document.getElementsByTagName('script')[0];
        s.onload = function() {
            alert("OK");
            $('#my_button').trigger('click');
        };
        x.parentNode.insertBefore(s, x);
    })();
}); 
</code></pre>

<p>With the alert there, all works fine. #my_button from the src script is clicked automatically. The problem is that as soon as I remove the alert(), trigger, click trigger is not called anymore.</p>

<p>Any idea why?</p>