5

This is from jQuery API docs:

typeString Default: 'GET' The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers.

I am going to make AJAX delete links with jQuery. What I would like to know is specifics about browser support for DELETE and PUT. Which browsers support it? Is it safer that I just go with POST?

Given that I work in ASP.NET MVC I can decorate my controller actions with both DELETE and POST so both can be accepted.

mare
  • 13,033
  • 24
  • 102
  • 191
  • 2
    Duplicate: http://stackoverflow.com/questions/165779/are-the-put-delete-head-etc-methods-available-in-most-web-browsers – Pekka Feb 18 '10 at 20:25

4 Answers4

5

Go with POST. You don't have to worry about browser support and future maintainers of your code will understand whats going on just fine.

John Farrell
  • 24,673
  • 10
  • 77
  • 110
  • 3
    Not just browser support, but also server support. DELETE isn't commonly seen outside of WebDAV ( http://en.wikipedia.org/wiki/Webdav ) – Powerlord Feb 18 '10 at 20:53
1

You could go with POST then set a form field named X-HTTP-Method-Override to DELETE.

See SO question #467535 for specific examples:

Is it possible to implement X-HTTP-Method-Override in ASP.NET MVC?

Community
  • 1
  • 1
Thomas Kjørnes
  • 1,928
  • 1
  • 17
  • 17
0

Extract from form value and send request, call Html.HttpMethodOverride(HttpVerbs.Delete) in form.

takepara
  • 10,413
  • 3
  • 34
  • 31
-3

If all you're doing is deleting an item with a certain ID, GET should suit your purposes: http://www.diffen.com/difference/Get_vs_Post

Just make sure you handle a case where someone tries to delete something that's already deleted

hackerhasid
  • 11,699
  • 10
  • 42
  • 60