How to send a PUT/DELETE request in jQuery?

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

GET:$.get(..)

POST:$.post()..

What about PUT/DELETE?

13条回答
  •  一个人的身影
    2020-11-22 13:28

    Here's an updated ajax call for when you are using JSON with jQuery > 1.9:

    $.ajax({
        url: '/v1/object/3.json',
        method: 'DELETE',
        contentType: 'application/json',
        success: function(result) {
            // handle success
        },
        error: function(request,msg,error) {
            // handle failure
        }
    });
    

提交回复
热议问题