Ticket #7171 (closed feature: fixed)
dataType plugins for $.ajax()
| Reported by: | eris.discord@… | Owned by: | kswedberg |
|---|---|---|---|
| Priority: | low | Milestone: | 1.5 |
| Component: | ajax | Version: | 1.4.4 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
This would be useful: dataType plugins for $.ajax() et al.
Plugins could register themselves to be placed between the ajax call and the success callback so that we could say, for instance,
$.ajax({ dataType: 'yaml', … })
and automatically be given an object. The plugin might be a simple function that accepts the response text and returns whatever is appropriate.
Perhaps a more advanced plugin could specify that it wants the response to be passed to it as XML, what response mime types it accepts, etc. For instance,
$.ajax({ dataType: 'plist', … })
might pass an XML Property List to the plugin, which would return an object deserialized from from it.
Change History
comment:1 Changed 3 years ago by snover
- Priority changed from undecided to low
- Status changed from new to open
- Component changed from unfiled to ajax
- Milestone 1.4.3 deleted
comment:3 Changed 2 years ago by jaubourg
- Keywords needsdocs added
The new ajax architecture is pluggable and is designed to allow custom dataTypes. Documentation is needed but it's there.
comment:4 Changed 2 years ago by jaubourg
- Owner set to kswedberg
- Status changed from open to assigned
Re-assigning to Karl. We're working on the doc these days.
comment:5 Changed 2 years ago by jitter
- Keywords ajaxrewrite needsdocs removed
- Status changed from assigned to closed
- Version changed from 1.4.2 to 1.4.4
- Resolution set to fixed
- Milestone set to 1.5
With 1.5 and the new ajax rewrite you can easily add custom dataType handling code. Check http://api.jquery.com/extending-ajax/ for more info
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
