13

The jQuery AJAX call has a type parameter that allows to specify the method for an async call (GET/POST/PUT/DELETE); documentation states that:

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.

What does this mean for modern browsers? Can I count on jQuery AJAX to make fully RESTful calls, which rely on the PUT and DELETE verbs?

Yuval Adam
  • 161,610
  • 92
  • 305
  • 395

2 Answers2

13

Yes. $.ajax makes the dirty work to allow PUT and DELETE.

Here you'll find more info: Are the PUT, DELETE, HEAD, etc methods available in most web browsers?

Community
  • 1
  • 1
Edgar Villegas Alvarado
  • 18,204
  • 2
  • 42
  • 61
  • Beat me to it! Exactly where I was going to link to, too! – James May 05 '11 at 08:07
  • 2
    their documentation states, "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." -- under 'type' on http://api.jquery.com/jQuery.ajax/ – Kristian Jan 14 '12 at 04:44
10

I know it's an old question, but I keep on coming here when searching for the browsers HTTP methods support. I never found anything saying exactly which browser supports which call. The link provided is not clear on it too.

Because of that sentence in jQuery manual (they are not supported by all browsers), I've stayed clear for a while of PUT and DELETE and tried to limit myself to GET and POST. However, today I decided to run some tests with IE 6 for a rest API I'm developing and I didn't have any problems to use also DELETE.

If it works in IE6, crappy 2001 technology, it is pretty much likely that it will work everywhere and that sentence on jQuery manual is pretty much obsolete.

I will update this post in the future with further tests. If anyone knows of a browser not supporting ajax calls for PUT and DELETE, I would like to hear.

stivlo
  • 83,644
  • 31
  • 142
  • 199
  • Hi, I have searched for more information on this, I understand DELETE is safe to use, have you had any experience with PUT ? – keisar Dec 01 '12 at 12:49
  • @inf3rno, any updates? I'm using IE9 and jquery 2.0.3... Also doesn't work for both DELETE & PUT – user2503775 Oct 27 '13 at 14:06
  • I don't know, I am developing on IE10+ now (because of CORS support). – inf3rno Oct 27 '13 at 15:36
  • @inf3no/user2503775- By all accounts PUT/DELETE *do* work on IE8/9. As far as I can tell the only HTTP method IE8 lacks native support for is PATCH. (See [here](https://github.com/jashkenas/backbone/issues/2152)). – Yarin Dec 16 '13 at 14:27