#10257 closed enhancement (plugin)
HTTP PUT and DELETE methods shorthand functions
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | ajax | Version: | 1.6.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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
Component: | unfiled → ajax |
---|---|
Priority: | undecided → low |
Resolution: | → wontfix |
Status: | new → closed |
comment:2 Changed 11 years ago by
"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 follow-up: 4 Changed 11 years ago by
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 Changed 11 years ago by
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
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
comment:6 Changed 11 years ago by
Resolution: | → plugin |
---|---|
Status: | reopened → closed |
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
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.
comment:8 Changed 10 years ago by
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.
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.