- The Book of Dojo
- Quick Installation
- Hello World
- Debugging Tutorial
- Introduction
- Part 1: Life With Dojo
- Part 2: Dijit
- Part 3: JavaScript With Dojo and Dijit
- Part 4: Testing, Tuning and Debugging
- Part 5: DojoX
- The Dojo Book, 0.4
Alternate Transports
Submitted by amaah on Tue, 06/05/2007 - 18:47.
Script request/JSONP (dojo.io.script)
To make an IO call using a script tag (for instance, for cross-domain JSONP calls), dojo.require("dojo.io.script"), and use:- dojo.io.script.get()
- callbackParamName: "". String. The URL parameter name that indicates the JSONP callback string. For instance, when using Yahoo JSONP calls it is normally, callbackParamName: "callback". For AOL JSONP calls it is normally callbackParamName: "c".
- checkString: "". String. A string of JavaScript that when evaluated like so: "typeof(" + checkString + ") != 'undefined'" being true means that the script fetched has been loaded. Do not use this if doing a JSONP type of call (use callbackParamName instead).
IFrame requests (dojo.io.iframe)
To send an IO call using an IFrame (for instance, to upload files), dojo.require("dojo.io.iframe"), and use:// gather all parameters from a form
dojo.io.iframe.send({
form: "idOfForm",
load: function(data){
console.debug(data); // successful response
}
});
// pass in all of the parameters manually
dojo.io.iframe.send({
method: "GET",
url: "iframeHandler.php",
content: {
param1: "la dee dah",
param2: "my poor electrons!",
},
load: function(data){
console.debug(data); // successful response
}
});
Specific arguments for dojo.io.iframe calls:
dojo.io.iframe.send({
form: "idOfForm",
load: function(data){
console.debug(data); // successful response
}
});
// pass in all of the parameters manually
dojo.io.iframe.send({
method: "GET",
url: "iframeHandler.php",
content: {
param1: "la dee dah",
param2: "my poor electrons!",
},
load: function(data){
console.debug(data); // successful response
}
});
- method: "POST". What type of HTTP method to use for the request. Valid values are "POST" (default) or "GET".
- handleAs: Valid values are text, html, javascript, and json. IMPORTANT: For all values EXCEPT html, The server response should be an HTML file with a textarea element. The response data should be inside the textarea element. Using an HTML document the only reliable, cross-browser way this transport can know when the response has loaded. For the text/html mimetype, just return a normal HTML document. NOTE: text/xml or any other XML type is NOT supported by this transport.
- Printer-friendly version
- Login or register to post comments
- Unsubscribe post
Documentation for dojo.script.io
There is some documentation for the dojo.script.io API in the migration doc here: http://dojotoolkit.org/book/dojo-porting-guide-0-4-x-0-9/io-transports-a...