today I\'ve been working on loading dynamic javascript code (files). The solution I use is :
function loadScript(scriptUrl) { var head = document.get
You can use jquery's getScript and pass a callback function.
$.getScript("test.js", function(){ alert("Script loaded and executed."); });
See: jquery.