SharePoint 2013 - Get list items using REST

Here I demonstrated how to fetch items of a SharePoint list using Rest.

Example code for REST:










//get the title of the site 
var siteUrl = _spPageContextInfo.webAbsoluteUrl;

//Ajax call to get data
    $.ajax({
        url: siteUrl + "/_api/web/lists/getbytitle('Give Title of List Name')/items",
        method: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        success: function (data) {
            var listitems = data.d.results;
           // listitems.forEach(function (entry) {
           //     $('#message').text(listitems["FirstName"]);
           // });
        },
        error: function (data) {
            alert("Error")
        }

    });

Comments

Popular posts from this blog

Download Visakhapatnam Tirupati AC Double Decker Express Act