Ajax发送put请求和delete请求

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) {}
});

你可能感兴趣的:(JavaScript)