欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Ajax发送put请求和delete请求

程序员文章站 2022-04-15 12:14:52
...

put请求

$.ajax({
    type: "put",
    url: "http://localhost:27221/api/Charging/Update",
    contentType: 'application/json',
    data: JSON.stringify({ ID: "1" }),
    success: function (data, status) {}
});

delete请求

var arr = [
    { ID: "1", NAME: "Jim", CREATETIME: "1988-09-11" },
    { ID: "2", NAME: "Lilei", CREATETIME: "1990-12-11" },
    { ID: "3", NAME: "Lucy", CREATETIME: "1986-01-10" }
];
$.ajax({
    type: "delete",
    url: "http://localhost:27221/api/Charging/OptDelete",
    contentType: 'application/json',
    data: JSON.stringify(arr),
    success: function (data, status) {}
});