Opened 14 years ago
Closed 14 years ago
#7083 closed enhancement (wontfix)
Allowing AJAX calls to supercede / abort / cancel previous calls within a given class
Reported by: | guest | Owned by: | anonymous |
---|---|---|---|
Priority: | high | Milestone: | 1.2 |
Component: | Core | Version: | 1.1.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Please take a look a this Prototype extension.
http://snippets.dzone.com/posts/show/1367
Would it be possible to add this feature to Dojo?
Here's an example how I would use it.
dojo.xhrGet ({
Location of the HTML content we want to grab url: '/demo-0.9/xhr/content.html',
onlyLatestOfClass: 'classname',
Called when the page loaded successfully load: function (data) {
dojo.byId('html-content').innerHTML = data;
},
Called if there was an error (such as a 404 response) error: function (data) {
console.error('Error: ', data);
}
});
Note: See
TracTickets for help on using
tickets.
Since dojo.xhrGet returns a dojo.Deferred object, you can create your own wrapper to do this. This is not a common enough use case to warrant inclusion in at least Dojo Core.
Here is how you could do it in your code (untested code, but should hopefully give the idea):