1var script = document.createElement('script');
2script.src = "https://www.examplesite/myscript.js";
3document.head.appendChild(script);
1document.writeln("<script type='text/javascript' src='Script1.js'></script>");
2document.writeln("<script type='text/javascript' src='Script2.js'></script>");
1// jQuery
2$.getScript('/path/to/imported/script.js', function()
3{
4 // script is now loaded and executed.
5 // put your dependent JS here.
6});