Bug Tracker

Modify

Ticket #9508 (closed enhancement: wontfix)

Opened 2 years ago

Last modified 2 years ago

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

comment:1 Changed 2 years ago by rwaldron

  • Priority changed from undecided to low
  • Resolution set to wontfix
  • Status changed from new to closed
  • Component changed from unfiled to ajax

This can be implemented by using an ajaxPrefilter:

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.