url: "http://bc-net/Sandbox/juandev/_api/web/lists/GetByTitle('Qlinks')/items",
               method: "GET",
               headers: { "Accept": "application/json; odata=verbose" },
               success: function (data) {
               var items = data.d.results;

                    if (items.length > 0 ) {
                         //This section can be used to iterate through data and show it on screen

              error: function (data) {
                  alert("Error: "+ data);

The console shows I have fetched the items that live on the list but I am not sure how to inject them on the website.

  • In what format do you want to show this data? I guess it is upto you, how you want to show these data.....You can use HTML and CSS for that. – Ganesh Sanap Jan 14 at 14:34

I see you are pulling your data with JQuery's $.ajax method and you have set up an if statement to check for data. Make sure your data is parsed in to a JavaScript object and not still a JSON string. If it's an object you can continue, if it is still a string, use:


I assume you want to then loop through your list items and display them on the page. If you haven't already, you need to place a Web Part on the page to put some HTML in there that you can use to display your data. You can use either the Script Editor, the Content Editor or the Embed Script option if your page allows that. Place this HTML in there:

<div id="myDiv"></div>

Now you are going to need to modify your code block to loop through your data and attach some HTML to your div element. Try the following in your if statement:

var el = document.getElementById("myDiv"); // get your div
var html = "<ul>"; // start a list

for(var i = 0; i < items.length; i++) { // loop through your data
    html += "<li>" + items[i].Title + "</li>";

html += "</ul>"; // end your list
el.innerHTML = html; // place your html in your div

This will make an un-ordered list to display the Titles of all your list items on your page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.