var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type="text/javascript";
script.onload = function() {
callFunctionFromScript();
}
script.src="https://stackoverflow.com/questions/5132488/path/to/your-script.js";
head.appendChild(script);