Login Register

add dojo programatically

Error while trying to add dojo programmatically to the DOM

Hi;

I have to load the dojo libraries programatically, but when I try this, I get the warning (from Firebug) that dojo is not defined. Here is some code:

dojolib = document.createElement('script');
dojolib.setAttribute("type","text/javascript")
dojolib.setAttribute("src", "/js/dojo/dojo/dojo.js");
dojolib.setAttribute("djConfig","parseOnLoad: true");
document.getElementsByTagName("head")[0].appendChild(dojolib);

// later on...

dojo.require(dojo.parser); // throws an error

Syndicate content