I need to get the no.of items in a SharePoint list which satisfying a condition.
https://<SITEURL>/_vti_bin/listdata.svc/LISTNAME/$count?&$filter=FIELDNAME eq 'abc'
using above url in browser gives me correct result.
So I Tried get it using below code,
getItems("/_vti_bin/listdata.svc/LISTNAME/$count?&$filter=FIELDNAME eq 'abc'").done(function(data){
console.log(data);
});
getitems
function,
function getItems(url){
return $.ajax({
url: _spPageContextInfo.webAbsoluteUrl + url,
type: "GET",
headers: {
"accept": "application/json;odata=verbose",
}
});
}
But using this code gives an error "415 Unsupported Media Type".
please help.