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?
Ajax is supported in all modern browsers. We suggest using the following browsers: Google Chrome. Mozilla Firefox.
ajax() can be used to send http GET, POST, PUT, DELETE etc. request. It can retrieve any type of response from the server.
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.
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.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With