GET
:$.get(..)
POST
:$.post()..
What about PUT/DELETE
?
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.
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.
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.
You could use the ajax method:
$.ajax({ url: '/script.cgi', type: 'DELETE', success: function(result) { // Do something with the result } });
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