SharePoint List Operations on SharePoint 2013 using REST API Services In - Part III (DELETE)
function deleteItemByID(id)
{
$.ajax
({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('SharePoint List Name')/items("+id+")",
type: "POST",
headers:
{
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"IF-MATCH": "*",
"X-HTTP-Method": "DELETE"
},
success: function(data, status, xhr)
{
//alert("Success");
},
error: function(xhr, status, error)
{
//Failure
}
});
}
{
$.ajax
({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('SharePoint List Name')/items("+id+")",
type: "POST",
headers:
{
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"IF-MATCH": "*",
"X-HTTP-Method": "DELETE"
},
success: function(data, status, xhr)
{
//alert("Success");
},
error: function(xhr, status, error)
{
//Failure
}
});
}
Comments
Post a Comment