Ticket #9508 (closed enhancement: wontfix)
Allow RESTful requests with JSON-P by adding the request type as parameter
| Reported by: | k@… | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | ajax | Version: | 1.6.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Currently it is not possible to call a REST API with JSON-P because the requests are always GET requests. But when an API already implemented this JSON-P hack to work at all via JSON-P then it would also be nice when the request type could be submitted with a special request parameter, too, so REST services could check this parameter in addition to the real HTTP method.
Example:
jQuery.ajax(url, { type: "DELETE", dataType: "jsonp" });
This should result in a GET request with these request parameters:
callback=jQuery16105071940436027944_1307104866864&_method=DELETE
I'm not sure if "_method" is a good parameter name but I've already seen multiple REST tutorials/articles which used this parameter name for calling PUT/DELETE URLs without Ajax in a browser.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This can be implemented by using an ajaxPrefilter:
http://api.jquery.com/jQuery.ajaxPrefilter/