Is there some equivalent to jQuery's getScript in Prototype ?
+2
A:
var head;
var script;
head = $$('head')[0];
if (head)
{
script = new Element('script', { type: 'text/javascript', src: 'dynamic.js' });
head.appendChild(script);
}
XGreen
2010-05-05 11:58:28
Im loading this script after a user interaction, so I dont think inserting in head would execute it, would it ?Anyway, I've used native JS to add this. Hopefully this works in all browsers.var fileref = document.createElement('script'); fileref.setAttribute("type","text/javascript"); fileref.setAttribute("src", "http://domain.com/script.js");
Phonethics
2010-05-05 13:16:48