Wikipedia API not working

Wikipedia API not working
0

#1

I am having trouble with calling the wiki api. I have the origin part, info in the ajax call, but I can’t get anything working. below is a snippet of the code, with the link to my codepen

var apiCall =
https://en.wikipedia.org/w/api.php?action=opensearch&search=” +
search +
"&format=json&origin=*";
$.ajax(apiCall,{

url: apiCall+"?client_id=vhk18fazw4ojdw1vt6maiccbufsv72",
type: "GET",
contentType: "application/json; charset=utf-8",
async: false,
dataType: "jsonp",
success: function(data) {
  console.log(data);

});


#2

I see two issues. One is that you haven’t added jQuery to your pen. Click on settings, then javascript. Then, in the quick-add dropdown, pick jQuery.

Second is a stray e.preventDefault(); at line 16 of your javascript tab. Needs to be deleted.

After those changes, it worked for me.


#3

Thank you. It worked!