Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does jQuery AJAX work in modern browsers with PUT and DELETE?

Tags:

rest

jquery

ajax

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?

like image 571
Yuval Adam Avatar asked May 05 '11 07:05

Yuval Adam


People also ask

Does AJAX work on all browsers?

Ajax is supported in all modern browsers. We suggest using the following browsers: Google Chrome. Mozilla Firefox.

Does Ajax support PUT method?

ajax() can be used to send http GET, POST, PUT, DELETE etc. request. It can retrieve any type of response from the server.

Which function is used to load a resource in the background in AJAX?

callback − A callback function invoked after the response data has been loaded into the elements of the matched set. The first parameter passed to this function is the response text received from the server and second parameter is the status code.

What is key in Ajax?

The key value pair that you are referring to is an Object. Referring to your line: data:{employee_id:employee_id} It passes an object to the data field of your . ajax() request.


1 Answers

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?

like image 111
Edgar Villegas Alvarado Avatar answered Oct 02 '22 12:10

Edgar Villegas Alvarado