REST: Get all List Items from List using REST Ajax Call in JQuery

  1. <html>  
  2.     <head>  
  3.         <script src="http://server:1122/sites/HR/SiteAssets/jquery-1.9.1.min.js"></script>  
  4.         <script>  
  5.             $( document ).ready(function() {  
  6.                 $.ajax({  
  7.                     url: "http://server:1122/sites/HR/_api/web/lists/getbyTitle('custom list')/items?$select=Title",  
  8.                     method: "GET",  
  9.                     headers: { "Accept""application/json; odata=verbose" },  
  10.                     success: function (data)  
  11.                     {  
  12.                         $('body').html(JSON.stringify(data));  
  13.                         console.log(JSON.stringify(data));  
  14.                         $.each(data.d.results, function(index, item){  
  15.                         console.log(item.Title);  
  16.                     });  
  17.                 },  
  18.                 error: function (data)  
  19.                 {  
  20.                     $('body').html(data);  
  21.                     console.log("error");  
  22.                 }  
  23.             });  
  24.         </script>  
  25.     </head>  
  26.     <body></body>  
  27. </html>