How to send a PUT/DELETE request in jQuery ? Last Updated : 01 Jul, 2024 Comments Improve Suggest changes Like Article Like Report To send PUT/DELETE requests in jQuery, use the .ajax() method, specifying the type as PUT or DELETE. This enables updating or deleting server resources via AJAX. Unlike .get() and .post(), jQuery lacks dedicated .put() and .delete() methods.ApproachTo 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 deleted according to the requirement as given in the example below.We will create a code example in which we will create two buttons that are going to make PUT and DELETE requests to an unknown server. We are going to see from the Network tab of the Chrome Developer tools whether the requests are working or not. We will create a file called test.html with a simple text GeeksforGeeks to which we are going to make the AJAX request and our main file is going to be index.html. When we click on any of the two buttons a new name will appear in the Network tab, we can click on it to see the type of the request in the Request Method option. We need to run this in a server, in the screenshots PHP server is being used.To open the Dev tools, Press Ctrl + Shift + I. Click on the Networks tab.Example: The example below shows the above explained approach. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <!-- Importing the jQuery --> <script src= "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> </head> <script> function makePUTrequest() { $.ajax({ url: 'test.html', type: 'PUT', success: function (result) { // Do something with the result } }); } function makeDELETErequest() { $.ajax({ url: 'test.html', type: 'DELETE', success: function (result) { // Do something with the result } }); } </script> <body> <button onclick="makePUTrequest()"> Click for PUT request </button> <button onclick="makeDELETErequest()"> Click for DELETE request </button> </body> </html> Output:Output in the Network tab when we click on the PUT request button:Output in the Network tab when we click on the DELETE request button: Comment More infoAdvertise with us Next Article How to send a PUT/DELETE request in jQuery ? G gurrrung Follow Improve Article Tags : Web Technologies JQuery HTML-Misc jQuery-Misc HTML-Questions +1 More Similar Reads How to perform DELETE requests in Postman? Postman is an API(application programming interface) development tool which helps to build, test and modify APIs. It can make various types of HTTP requests(GET, POST, PUT, PATCH), save environments for later use, and convert the API to code for various languages(like JavaScript, and Python). In thi 2 min read How to Send FormData Objects with Ajax-requests in jQuery ? In this article, we will see how can we send formData objects with Ajax requests by using jQuery. To send formData, we use two methods, namely, the FormData() method and the second method is serialize() method. The implementation of Ajax to send form data enables the submission of data to the server 4 min read How to Send an HTTP POST Request in JS? We are going to send an API HTTP POST request in JavaScript using fetch API. The FetchAPI is a built-in method that takes in one compulsory parameter: the endpoint (API URL). While the other parameters may not be necessary when making a GET request, they are very useful for the POST HTTP request. Th 2 min read How to create and send POST requests in Postman? Postman is an API(application programming interface) development tool which helps to build, test and modify APIs. It can make various types of HTTP requests(GET, POST, PUT, PATCH), saving environments for later use, and convert save the API to code for various languages(like JavaScript, and Python). 2 min read How to read write and delete cookies in jQuery? In this article, we will learn how to read, write and delete cookies in jQuery. This can be done using the cookie() and removeCookie() methods of the jquery-cookie library. We will first understand what exactly is a cookie.Cookie: Cookies are small blocks of data created by a web server when a user 3 min read Like