var script = document.createElement('script');
script.src = 'http://example.com/script.js';
document.getElementsByTagName('head')[0].appendChild(script);
alert('script loaded');
$.getScript('http://example.com/script.js', function(){
alert('script loaded');
});