Skip to main content

Bug Tracker

Side navigation

#9508 closed enhancement (wontfix)

Opened June 03, 2011 12:52PM UTC

Closed June 03, 2011 04:00PM UTC

Allow RESTful requests with JSON-P by adding the request type as parameter

Reported by: k@ailis.de Owned by:
Priority: low Milestone: 1.next
Component: ajax Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
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.

Attachments (0)
Change History (1)

Changed June 03, 2011 04:00PM UTC by rwaldron comment:1

component: unfiledajax
priority: undecidedlow
resolution: → wontfix
status: newclosed

This can be implemented by using an ajaxPrefilter:

http://api.jquery.com/jQuery.ajaxPrefilter/