$.ajax({
url: "http://servername:1122/sites/HR/_api/web/lists/getbytitle('Documents')/items?$select=ID,FileRef,FileLeafRef",
method: "GET",
headers: {
"Accept": "application/json; odata=verbose"
},
success: function(data) {
$('body').html(JSON.stringify(data));
console.log(JSON.stringify(data));
$.each(data.d.results, function(index, item) {
console.log(item.ID + "," + item.FileRef + ", " + item.FileLeafRef);
});
},
error: function(data) {
$('body').html(data);
console.log("error");
}
});This code snippet show how to using REST all items from SharePoint document library in j query by ajax call.
