Here is the script:
$("#button").click(function(){
$.getScript('script.js', function(){
script.init();
});
});
I want to be able to run script.init() like the above example, but if I do it like this, I have to click the button twice to be able to get the script. -When it runs script.init() the first time, it is not loaded yet it seems.
So how can I make sure the script is loaded before I do something with it?