Login Register

Dojo Not Defined (Odd One here)

Ok this is a bit odd but I will try and explain.

I have a javascript function that is dynamically adding a script tag to include dojo.js.

I can see in Firebug the script is loading the js file perfectly. I then have a second function that does my dojo.require statements.

What I get is dojo is not defined. When clearly I can see that it is.

So I thought well I will get clever and just dynamically create a series script tags to insert each of the js files for each of the modules I want to use.

Then I get dijit.byId is not a function.

How do I resolve this.

And yes I have to Dynamically create the js inserts so static loading is not an option

TIA

Jeff

If you are loading the Dojo

If you are loading the Dojo script after page load, then you will want to look at using djConfig.afterOnLoad, and possibly djConfig.require. If you are using Dojo 1.2, you can use djConfig.addOnLoad to do your initialization work too. More details in this blog post:
http://tagneto.blogspot.com/2008/10/dojo-12-loader-and-build-system.html

See the djConfig.addOnLoad section for an example page.