Bug Tracker

Opened 8 years ago

Closed 8 years ago

#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:
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.

Change History (1)

comment:1 Changed 8 years ago by Rick Waldron

Component: unfiledajax
Priority: undecidedlow
Resolution: wontfix
Status: newclosed

This can be implemented by using an ajaxPrefilter:

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

Note: See TracTickets for help on using tickets.