How to send a PUT/DELETE request in jQuery?

前端 未结 13 2236
别跟我提以往
别跟我提以往 2020-11-22 12:54

GET:$.get(..)

POST:$.post()..

What about PUT/DELETE?

13条回答
  •  粉色の甜心
    2020-11-22 13:30

    You can do it with AJAX !

    For PUT method :

    $.ajax({
      url: 'path.php',
      type: 'PUT',
      success: function(data) {
        //play with data
      }
    });
    

    For DELETE method :

    $.ajax({
      url: 'path.php',
      type: 'DELETE',
      success: function(data) {
        //play with data
      }
    });
    

提交回复
热议问题