1function loadScript( url, callback ) {
2 var script = document.createElement( "script" )
3 script.type = "text/javascript";
4 script.onload = function() {
5 callback()
6 };
7}
8// call the function...
9loadScript("js/myscript.js", function() {
10 alert('script ready!');
11});