Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send a PUT/DELETE request in jQuery?

GET:$.get(..)

POST:$.post()..

What about PUT/DELETE?

like image 785
user198729 Avatar asked Jan 28 '10 10:01

user198729


People also ask

How can you make put and delete request in jQuery?

Approach: To make a PUT or DELETE requests in jQuery we can use the . ajax() method itself. We can specify the type of request to be put or delete according to the requirement as given in the example below.

How to send DELETE request ajax?

Suppose we have to do the asynchronous HTTP DELETE request, to delete the data available at the server. So we can use the ajax() function with type option as “$. ajax( 'http://time.jsontest.com', { type : “DELETE});”, where the first parameter is the URL of the data that to delete.

How to DELETE using jQuery?

jQuery remove() Method The remove() method removes the selected elements, including all text and child nodes. This method also removes data and events of the selected elements. Tip: To remove the elements without removing data and events, use the detach() method instead.


1 Answers

You could use the ajax method:

$.ajax({     url: '/script.cgi',     type: 'DELETE',     success: function(result) {         // Do something with the result     } }); 
like image 195
Darin Dimitrov Avatar answered Nov 17 '22 03:11

Darin Dimitrov