views:

39

answers:

0

Dear all, consider this:

core.js:
    var core = 
    {
        all:{},
        load: function(jsUrl)
        {
            $.ajaxStup({async, false});
            $.getScript(jsUrl);
        },
        init: function ()
        {

            $.getJSON('someurl', function(data)
            {
                for(key in this.all)
                    alert(key);

            });
         },
         here: function(who)
         {
             this.all[who.name] = who;
         }
    };
    $(document).ready(function()
    {
        core.init();
    });

me.js 
    (function()
    {
        core.here({name:"me", foo:"bar"});
    })();     


CASE 1:
    <script type="text/javascript" src="/jquery.js"></script>
    <script type="text/javascript" src="/core.js"></script>
    <script type="text/javascript"> 
        core.load("/me.js");
    </script>         

CASE 2:
    <script type="text/javascript" src="/jquery.js"></script>
    <script type="text/javascript" src="/core.js"></script>
    <script type="text/javascript" src="/me.js"></script>

The problem is that for case 1 I get an alert, as I should , but for case 2, no alert... So the question is : there is a load event for the tag? or what can I use to synchronize the files to work on case 2 (while debugging in IE8, I noticed that using a breakpoint solves the problem)... is there anything I`m missing?