SharePoint List Operations on SharePoint 2013 using REST API Services In - Part IV (GET All Items)
function GetItems()
{
$.ajax
({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('SharePoint List Name')/items?$select=Column1,Column2",
type: type,
data: data,
headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"IF-MATCH": "*",
"X-HTTP-Method": null
},
cache: false,
success: function(data)
{
//success - bind values here
$("#sampleDIV").empty();
for (var i = 0; i < data.d.results.length; i++)
{
var item = data.d.results[i];
$("#sampleDIV").append(item.Column1);
}
},
error: function(data)
{
//Failure
}
});
}
{
$.ajax
({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/GetByTitle('SharePoint List Name')/items?$select=Column1,Column2",
type: type,
data: data,
headers:
{
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"IF-MATCH": "*",
"X-HTTP-Method": null
},
cache: false,
success: function(data)
{
//success - bind values here
$("#sampleDIV").empty();
for (var i = 0; i < data.d.results.length; i++)
{
var item = data.d.results[i];
$("#sampleDIV").append(item.Column1);
}
},
error: function(data)
{
//Failure
}
});
}
Comments
Post a Comment