I basically do like this, create new element and attach that to <head>
var x = document.createElement('script');
x.src = 'http://example.com/test.js';
document.getElementsByTagName("head")[0].appendChild(x);
You may also use onload
event to each script you attach, but please test it out, I am not so sure it works cross-browser or not.
x.onload=callback_function;