SharePoint 2013,
function deleteListItem(url, listname, id, success, failure) {
// getting our item to delete, then executing a delete once it's been returned
getListItem(url, listname, id, function (data) {
$.ajax({
url: data.d.__metadata.uri,
type: "POST",
headers: {
"Accept": "application/json;odata=verbose",
"X-Http-Method": "DELETE",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"If-Match": data.d.__metadata.etag
},
success: function (data) {
success(data);
},
error: function (data) {
failure(data);
}
});
});
};
/_api/web/lists
,function deleteListItem(url, listname, id, success, failure) {
// getting our item to delete, then executing a delete once it's been returned
getListItem(url, listname, id, function (data) {
$.ajax({
url: data.d.__metadata.uri,
type: "POST",
headers: {
"Accept": "application/json;odata=verbose",
"X-Http-Method": "DELETE",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"If-Match": data.d.__metadata.etag
},
success: function (data) {
success(data);
},
error: function (data) {
failure(data);
}
});
});
};
No comments:
Post a Comment