Need help with API wikipedia viewer

I don’t why when I type some result in the input, some works and some doesn’t work?
Link to my code: http://codepen.io/hungnguyen1895/pen/Zpvakq

Because you’re using a <button> for your search button, which by default tries to send data and reload the page, you’ll have to use preventDefault() in your event handler.

$(".search").on("click", function(event) { //<-- note that we're passing in an event object
    event.preventDefault();
    //...
}

thank you so much fam !!!

Would you be able to elaborate more on this feature of button because it’s the first I’ve heard of this issue.

button elements, by default, are of type submit.

<!--these are the same-->
<button>Click me!</button>
<button type="submit">Click me!</button>

The submit event triggers a redirect. Without setting the form method and action in a form element, you get sent to the same page you submitted from, but the net effect is that the page refreshes. Any data you received from an AJAX call will be wiped and you’ll be back to your page’s initial state. Using the preventDefault method on the event object stops this from happening and lets you carry out other actions. You could also change the button’s type so it doesn’t redirect:

<button type="button">Click me!</button>