Information disappears when trying to add it to my page

So, I finally figured out how to get the data I need from the Wikipedia api, but whenever I try adding it to my page, it disappears. The input also disappears after you submit several times seemingly at random, but it seems more likely when you type in a longer search term,
Any help would be greatly appreciated!

When you click the button, the form is trying to submit to the same page (kind of like reloading the page) before your JavaScript has a chance to show anything. To prevent this, you need to call preventDefault method inside the button click’s callback function on input (which is the event object).


Once you resolve the above issue, you still have other issues with your current code that you need to address. Take a look at your browser’s console (Ctrl+Shft+J in Chrome) to see any errors.

In addition to what Randell points out, I would also add that you should be careful with your loops:

         for(i=1; i<=data.length; i++){
           for(j=0; j<= data[i].length; j++)

Your condition i<=data.length will cause a fence posting error. If you array has 10 elements, then the highest index is 9 and these loops will try to access one past that. You want i<data.length and j<data[i].length.