How to fetch list items usng Rest service in Sharepoint 2013
// get multiple items
var requestUri = _spPageContextInfo.webAbsoluteUrl + '/_api/Web/Lists/getByTitle(\'Contacts\')/items/' + '?$select=Id,FirstName,Title,Email'
// execute AJAX request
var requestHeaders = { 'accept': 'application/json;odata=verbose' };
$.ajax({
url: requestUri,
contentType: 'application/json;odata=verbose',
headers: requestHeaders,
success: function (response){
/* do something on success */ },
error: function(error)
{ /* do something on fail */ } });
No comments:
Post a Comment