Bug Tracker

Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#10257 closed enhancement (plugin)

HTTP PUT and DELETE methods shorthand functions

Reported by: [email protected] Owned by:
Priority: low Milestone: None
Component: ajax Version: 1.6.3
Keywords: Cc:
Blocked by: Blocking:


More and more people are using all the HTTP verbs everyday, with new server-side RESTful frameworks being released that support those. It would be nice to have some HTTP PUT and DELETE shorthand functions, a bit like jQuery.get and jQuery.post.

Change History (8)

comment:1 Changed 12 years ago by timmywil

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

Unfortunately, put and delete are not supported across browsers. We could not support these consistently and it would cause confusion as many server side frameworks have their own solutions for supporting put and delete across browsers. For instance, django will always use post as the method, but add a hidden input containing the "actual" type of request. In which case, $.post is used for sending these forms with put and delete.

comment:2 Changed 11 years ago by anonymous

"Unfortunately, put and delete are not supported across browsers."

HTML forms (up to HTML version 4 and XHTML 1) only support GET and POST as HTTP request methods. A workaround for this is to tunnel other methods through POST by using a hidden form field which is read by the server and the request dispatched accordingly.

However, for the vast majority of RESTful web services GET, POST, PUT and DELETE should be sufficient. All these methods are supported by the implementations of XMLHttpRequest in all the major web browsers (IE, Firefox, Opera).

comment:3 Changed 11 years ago by umassthrower

Hmm, little shocked at the fact that this is not yet supported. It's unfortunate that this was brushed off 12 months ago because of misinformation.

comment:4 in reply to:  3 Changed 11 years ago by jaubourg

Replying to umassthrower:

Hmm, little shocked at the fact that this is not yet supported.

This is supported in ajax by setting the type option accordingly.

comment:5 Changed 11 years ago by dmethvin

Resolution: wontfix
Status: closedreopened

comment:6 Changed 11 years ago by dmethvin

Resolution: plugin
Status: reopenedclosed

Anyone who wants this can easily conjure a plugin that wraps $.ajax. It doesn't belong in core.

comment:7 Changed 10 years ago by jasonm23

I'm not sure where the logic of these wrappers not "belonging in the core" is coming from, by the same rationale, neither do $.get or $.post - both attach to the same method, and the object name is used as the ajax type: parameter.

Last edited 10 years ago by jasonm23 (previous) (diff)

comment:8 Changed 10 years ago by [email protected]

I'm not sure what's brewing up here. I was the original author of the ticket, and while I have since made it into a plugin for my own use, it should be noted that you can't use the word "delete" as a property name in JavaScript, so it would have to be called something else if ever implemented in core. I called it $.del.

Note: See TracTickets for help on using tickets.