Help with Wikipedia Viewer- Search results are not displaying

Hello I am currently on the wikipedia viewer project. I am having problems trying to display my search results. I got the wikipedia api working and when i placed in a browser it showed the JSON object that i needed. I used the For loop to iterate through the object and display the title and content of each page but it is not displaying it. This is my javascript code:

function processArticlePages(item) {

   for (i = 0; i < item.query.length; i++) {

 $("#results").html("<p>" + item.query.title[i] + "</p>");



$(".search_button").on("click", function() {
   var searchString = $("#searchBox").val();

  if (searchString) {

   type: "GET",
   data: {    
     action: 'query',
     generator: 'search',
     gsrlimit: 5,
     origin: '*',
     format: 'json',
   datatype: "json",
   url: "",

   success: processArticlePages

 return false;


Well I’m not kinda professional but you might wanna try success:processArticlePages(response) option ? You need to assign processArticlePages(item) items in success line.

OK let me try that. Cheers bruv