javascript include a js file from another

JavaScript
var script = document.createElement('script');
script.src = "https://www.examplesite/myscript.js";
document.head.appendChild(script); // jQuery
$.getScript('/path/to/imported/script.js', function()
{
    // script is now loaded and executed.
    // put your dependent JS here.
});
Source

Also in JavaScript: