jquery的ajax实现PUT与DELETE请求

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_41556165/article/details/82414822

实现PUT 

$.ajax({
  url: "http://localhost:10320/api/Person/4",
  type: "POST",
  data: JSON.stringify(whatever),
  headers: { 
      "Content-Type": "application/json",
      "X-HTTP-Method-Override": "PUT" }, //PUT,DELETE
})

实现DELETE

$.ajax({
  url: '/test',
  type: 'DELETE',
  data: {}
});

猜你喜欢

转载自blog.csdn.net/weixin_41556165/article/details/82414822
今日推荐