Wikipedia api Ajax call unsuccessful

Hi All

I have a problem with my Wikipedia viewer so far.

I have done all the coding which should take the word searched e.g. “apple” and add it to the Wikipedia API to get the correct URL link to the available option under apple. The problem is when I try and do a AJAX call to the API it does not respond.
I have read everything I can on this problem e.g. Wikipedia Viewer: Wikipedia API & Cross-Origin Request Issues, and even then I cannot seem to solve my problem.
When I console.log the API before it gets ready by the AJAX call it console.log fine. The API, when pasted into the URL, reads successfully, but if I console.log it after the AJAX call it does not do anything.

Perhaps someone can please explain to me what I am doing wrong.

P.S. I have also attempted using origin=* according to the Wikipedia API documentation.

HTML line 4, make it:

<form onsubmit="wikiFunc; return false;">

Hey Jenovs

Thanks you so much, it is amazing how a single incomplete line of code can cause so much stress.

It is much appreciated.