Wikepedia viewer, can't get the results to display

Here is my code: https://codepen.io/Kestvir/pen/mmydgm?editors=1111

When I press search, sometimes the results appear for a millisecond and then disappear and the page reloads, or either the results don’t appear at all and the page reloads. When I console.log the data, I get the correct everything, so something must be off with the part which should display the search results correctly, but the problem is that, I don’t even get a single error in the console.

Much help would be appreciated.

  $('#search').click(function(e){  // <-- Add (e)
    e.preventDefault();  // <-- Add this

Thank you very much, it worked like a charm. Maybe you could also tell me, why some of the other Wikipedia Viewer Apps manage to display everything without using the e.preventDefault();

For e.g: https://codepen.io/PizzaPokerGuy/pen/MyPVPw?editors=1010

When you submit a form the default action is to refresh the page. To prevent it you use e.preventDefault().

The codepen you posted doesn’t use form.