Namespace Jelo.Ajax
Robust AJAX object. Includes concepts from http://adamv.com/dev/
and http://extjs.com/ as well as JDOMPer.
Defined in: Jelo.Ajax.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
Jelo.Ajax.loadScript
http://www.nczonline.net/blog/2009/06/23/loading-javascript-without-blocking/
|
Method Attributes | Method Name and Description |
---|---|
<static> |
Jelo.Ajax.isBusy()
|
<static> |
Jelo.Ajax.jdomp(config)
Performs an AJAX call without XMLHttpRequest objects.
|
<static> |
Jelo.Ajax.request(config, abortable)
Traditional AJAX request, supports (optional) caching.
|
Field Detail
<static>
Jelo.Ajax.loadScript
http://www.nczonline.net/blog/2009/06/23/loading-javascript-without-blocking/
Method Detail
<static>
Jelo.Ajax.isBusy()
- Returns:
- True if an abortable Jelo.Ajax.request call is pending. Pending requests made using {abortable: false} are not counted here.
<static>
Jelo.Ajax.jdomp(config)
Performs an AJAX call without XMLHttpRequest objects. Spiffy. Google
"jdomp", the guy has posted the idea on a bunch of web dev forums,
but I'm not sure if he has an official website.
Note: parameters should be passed as a configuration object.
Note: parameters should be passed as a configuration object.
- Parameters:
- {Object} config
- A configuration object.
- {String} config.url
- Target URL to load (the script can be dynamically generated by a server-side language, but the output Content-Type must be text/javascript)
- {Boolean} config.cache Optional, Default: false
- If false, add a timestamp to the call to avoid caching the response. If true, it also assigns the script a unique ID that can be referred to later.
- {Object} config.params Optional
- Additional parameters to pass to the script via its query string. Not particularly useful for .js files, but potentially useful if the script is served via PHP or another server-side language.
- {Function} config.callback Optional
- Method to invoke after the JDOMPed script executes. NOTE: Do NOT use nested callbacks to JDOMP scripts with additional callbacks! If you do, callbacks beyond the first will be executed multiple times!
<static>
Jelo.Ajax.request(config, abortable)
Traditional AJAX request, supports (optional) caching. Parameters
should be passed in a configuration object.
- Parameters:
- {Object} config
- A configuration object
- {String} config.url
- The URL to send a request to.
- {String} config.method Optional, Default: "GET"
- GET, POST, PUT or DELETE.
- {Object} config.data Optional
- Parameters to pass to the URL.
- {Object} config.params Optional
- Alias for config.data
- {Boolean} config.cache Optional, Default: false
- True to save the response in the local cache, or retrieve the stored response if available. False to always make a new request and return fresh results.
- {Boolean} abortable Optional, Default: false
- If true, this call will interrupt any pending AJAX requests which are also abortable. Each request that is NOT abortable can execute simultaneously with other requests.
- {Function} config.success Optional
- Method to invoke when the request successfully completed (200 or 304 HTTP status code). The function gets passed the XMLHttpRequest object and the original config object. In the callback function, "this" refers to the XMLHttpRequest object. If the response Content-Type is text/xml, this.responseXML should be available. Otherwise, get the response using this.responseText.
- {Function} config.failure Optional
- Method to invoke when the request was NOT successfully completed. The function gets passed the XMLHttpRequest object and the original config object. In the callback function, "this" refers to the XMLHttpRequest object. The status code is available as this.status.
- {Function} config.callback Optional
- Method to invoke when the request returns, whether or not the call was successful. Can be useful for cleanup or notification purposes. The function gets passed the XMLHttpRequest object and the original config object. In the callback function, "this" refers to the XMLHttpRequest object. If included, this method will be invoked AFTER both the success and failure functions (if applicable).