Use SP Services to Get List Items Details

Hello Readers,
 
We developers need to use SP Services a lot in our day to day activities. To save your effort and time, we will see a code st up to get all the details of all items in the list through SP Services which you can use in your respective projects.
 
Let's see, how can we achieve it.
  1. Open a page in SharePoint.
  2. Edit the page
  3. Add a HTML Form Web part on the page.
  4. Paste the following code. 
On the refresh or on the document.ready function you will receive an alert with all the details of the items in the list by calling SP Services which you can use in your respective functionality.
 
As per the script, first we are using jquery.SPServices-0.7.2.min.js for reference to SP Services and then we can see from our script how to call in the service.
 
Script: 
  1. // Reference  
  2. < script src = "/SiteAssets/jquery-1.11.2.min.js" > < /script> < script src = "/SiteAssets/jquery.SPServices-0.7.2.min.js"  
  3. type = "text/javascript" > < /script> < script >  
  4.     // On load function or on refresh of the page.  
  5.     $(document).ready(function() {  
  6.         // Call the SP Services  
  7.         $().SPServices({  
  8.             operation: "GetListItems",  
  9.             async: false,  
  10.             //Specify the name of the list you want details of.   
  11.             listName: "Test",  
  12.             completefunc: function(xData, Status) {  
  13.                 //The following alert will Get you all list content in al alert  
  14.                 alert(xData.responseText);  
  15.                 $(xData.responseXML).SPFilterNode("z:row").each(function() {});  
  16.             }  
  17.         });  
  18.     }); < /script>  
With (xData.responseText) you will get all the properties of each item on the list which will make your work easier to achieve your functionality.
So just a minute code, paste it and you will have all the details in just a load of the page. Keep Learning!
Cheers!