how to import script in js code example
Example 1: include other js files in a js file
document.writeln("<script type='text/javascript' src='Script1.js'></script>");
document.writeln("<script type='text/javascript' src='Script2.js'></script>");
Example 2: javascript include a js file from another
// jQuery
$.getScript('/path/to/imported/script.js', function()
{
// script is now loaded and executed.
// put your dependent JS here.
});
Example 3: How to add js file to a site through url
var jsFile = document.createElement("script");
jsFile.src = "homePage.js"; // it can be path also "{themes('/scripts/homePage.js')}"
document.body.appendChild(jsFile); //append it as src to body