How to send a PUT/DELETE request in jQuery?

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

GET:$.get(..)

POST:$.post()..

What about PUT/DELETE?

相关标签:
13条回答
  • 2020-11-22 13:35

    For brevity:

    $.delete = function(url, data, callback, type){
    
      if ( $.isFunction(data) ){
        type = type || callback,
        callback = data,
        data = {}
      }
    
      return $.ajax({
        url: url,
        type: 'DELETE',
        success: callback,
        data: data,
        contentType: type
      });
    }
    
    0 讨论(0)
提交回复
热议问题