Wikipedia Viewer Problem Help

Wikipedia Viewer Problem Help
0

#1

Hi guys,
I have a problem with Wikipedia Viewer. It does not want to show wikipedia articles after searching them. Here is my CodePen

Thanks in advance


#2

I haven’t looked through your code too carefully but I think the problem is because the text <input> element is inside a form and submitting it triggers the default behaviour and causes the page the refresh. I did a quick test and it seems to be the case, you can stop the behaviour with the event.preventDefault() method:

    $('.search-form').submit(function(event) {
        event.preventDefault();

        // ...
    }

If you open the developer console of your browser you can see that pressing Enter will now trigger an API call.

It looks like you have other problems in your code to debug though! Good luck!