Get list Items Using Rest API SharePoint 2013
$(document).ready(function () {
var value = getParameterByName("pg");
// alert(value);
$.ajax({
method: 'GET',
url: window.location.origin+_spPageContextInfo.webServerRelativeUrl+"/_api/Web/lists/GetByTitle('ContentPages')/items?$select*&$filter=Title eq '"+value+"'",
headers: { "Accept": "application/json;odata=verbose" }
}).success(function (d, s, h, c) {
var result = d["d"]["results"];
if (result.length != 0) {
$.each(result, function (i, j) {
var content = result[0]["Content"];
$("#divContent").html(content);
});
}
});
});
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var value = getParameterByName("pg");
// alert(value);
$.ajax({
method: 'GET',
url: window.location.origin+_spPageContextInfo.webServerRelativeUrl+"/_api/Web/lists/GetByTitle('ContentPages')/items?$select*&$filter=Title eq '"+value+"'",
headers: { "Accept": "application/json;odata=verbose" }
}).success(function (d, s, h, c) {
var result = d["d"]["results"];
if (result.length != 0) {
$.each(result, function (i, j) {
var content = result[0]["Content"];
$("#divContent").html(content);
});
}
});
});
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
Comments