Wiki Viewer results not displaying


Hi, this is my code here. I’ve tried for loops and each loops, but neither are displaying anything after the first result.
I’m really not sure where the problem is. Any help would be really appreciated.

The console.log there just shows that the API works perfectly, the whole problem is in displaying any results after the first one.


I updated my pen here.

I realised the whole problem was in .append(), for some reason (if you can explain, I’d be grateful). It happens only to work once, and that’s it. So, I thought I’d use .after(), which seems to work absolutely fine.


.append() will keep adding to your HTML over and over with every search result. You need to .empty() the HTML first, before you call your $.getJSON and .append() again.


I have tried this, but sadly it doesn’t work. Thank you for the input though!


It works great for me - here’s a fork of your codepen with .empty() before the $.getJSON: