How to load one JavaScript file from another?

There’s no @import-ish function/method in Javascript, but you can simply append a script to the <head> tag like so:

var newScript = document.createElement('script');
newScript.type="text/javascript";
newScript.src="https://stackoverflow.com/path/to/js/file";
document.getElementsByTagName('head')[0].appendChild(newScript);

Or like Edgar mentioned right before me you can use jQuery.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)