Login Register

dojo.io.* and dojo.oi.bind is not a function

Hi there.
I'm a beginner with dojo, and i don't understant something.
I've tried using a code found on posts :

dojo.require("dojo.io.*");
dojo.require("dojo.dom");

and it doesn't work : "Could not load 'dojo.io.*'; last tried './io/*.js'"
then i tried to manually load all files in io :

dojo.require("dojo.io.iframe");
dojo.require("dojo.io.script");
dojo.require("dojo.dom");

But now : "Could not load 'dojox.dom'; last tried '../dojo/dom.js'"

It's really irrating. I've found nothing to explain that. And i'm really desapointed, because I try to parse xml data with ajax, and i've found very few things explaining that... but what is ajax without the X of xml?

thanx.


Have a look at

Have a look at [your_dojo_dir]\dojox\xml\DomParser.js
Thus you have to: dojo.require("dojox.xml.DomParser");
You might find something at "http://dojotoolkit.org/book/dojo-book-0-9/part-5-dojox/dojox-xml-utilities". I can't access it currently, but google showed up this link.

The reason those calls you

The reason those calls you mention don't work is because they are old (from 0.4) The porting guide will show you some of the differences between 0.4.x and 0.9+. See http://dojotoolkit.org/book/dojo-porting-guide-0-4-x-0-9

Here are the book entries for doing IO requests: http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-...

In regards to your last comment about X of xml in ajax, XML really has absolutely nothing to do with ajax, despite it being in the name. In fact it is only in the name because the developers that needed it at Microsoft named it that way to get the feature included. the "ajax request" really is only a background request. When using dojo, you can dojo dojo.xhrGet({url: "foo.php", handleAs: "xml".....}); This will do a Get request using ajax and will automatically transform the resulting doc into an xml document before handing it back off to you.

I am using 1.0.2 and I did a

I am using 1.0.2 and I did a custom release (standard profile) with xdomain.
I am trying to load dojo.io.* but failed (the same error as the original post)

 

dojo.require("dijit.Dialog");       
       dojo.require("dojo.io.*");

Can anybody tell me why and what I did wrong?

Thanks.

dojo.io.* does not exist in

dojo.io.* does not exist in Dojo 1.0. The XMLHttpRequest methods are under dojo.xhr**, part of dojo.js, then there is dojo.io.script and dojo.io.iframe. See dmachi's reply above for more information.

Did you mean dojo.xhr.* (not

Did you mean dojo.xhr.* (not dojo.xhr**)?
What do I need to do to enable wildcard loading (such as dojo.xhr.*, lazy loading) when I do a custom release with zxdomain? It does not seem that lazy loading works for my custom release.

Thanks.

BTW, do you have a sample code for ajax with dojo 1.0 version?

Sorry, I meant to use the

Sorry, I meant to use the dojo.xhr* for a placeholder for all XHR (XMLHttpRequest) methods in Dojo: dojo.xhrGet(), dojo.xhrPost(), dojo.xhrDelete(), dojo.xhrPut(), and in Dojo 1.1, there is just a dojo.xhr() generic method too. In Dojo 1.0+, you do not need to dojo.require() a module to get the XHR methods -- they are part of dojo.js.

For code examples, see the XMLHttpRequest chapter in the Dojo book.

No wildcard package loading in 1.*

The wildcard loading that you could do in 0.4 is not available in 1.x. If you want to be able to load several modules with one require statement, you can make your own rollup. Its a simple file that might look like this:

dojo.provide("dojo.io.alltransports"); 

dojo.require("dojo.io.iframe");
dojo.require("dojo.io.script"); 

and be saved in this case as dojo/io/alltransports.js. Better might be to put it in your own "namespace" as myns.io.alltransports, which would be ../myns/io/alltransports.js (from the dojo directory)

Ultimately, you'll want to do a custom build which kind of removes the need for this, as you'll tend to move these definitions into your build profile and layers. But it can be convenient. To see another example, look at dijit/dijit.js, or dijit/dijit-all.js