Return to Snippet

Revision: 63530
at May 15, 2013 03:29 by rumremix


Initial Code
function getTitles() {
 
  // begin work to call across network
  var requestUri = _spPageContextInfo.webAbsoluteUrl +
                       "/_api/Web/Lists/getByTitle('LandingMiddleLinks')/items";
 
  // execute AJAX request
  $.ajax({
    url: requestUri,
    type: "GET",
    headers: { "ACCEPT": "application/json;odata=verbose" },
    success: function(data){
      
   		$.each(data.d.results, function(index) {
			 console.log($(this).attr('Title'));
		  
		});
      
    },
    error:  function(){
      alert("Failed to get title");
    }
  });
}

Initial URL

                                

Initial Description
The following code fetches contents of each Title field from the list called "LandingMiddleLinks"

Initial Title
How to retrieve data from a list in Sharepoint 2013 using oData and JavaScript

Initial Tags
javascript, list, sharepoint

Initial Language
JavaScript