I have seen Scriptaculous.js file to include its required javascript files dynamically. Is there any better approach to include javascript dynamically.
For example,
We can quickly extend this so that a callback can be performed once the script is added.
function loadjscssfile(filename, filetype, callback){ if (typeof fileref!="undefined") { document.getElementsByTagName("head")[0].appendChild(fileref); callback(); } }