Reputation: 91
I'm making this API call on Wikipedia but it return empty objects. I guess it's something to do with the format (jsonp?).
This is the call:
apiCall = "https://en.wikipedia.org/w/api.php?action=query&format=json&callback=?prop=info|extracts&generator=search&callback=?&inprop=url&exsentences=3&gsrsearch=";
////////////Get info from API///////////
$.getJSON(apiCall + userSearch, function(data){
console.log(data);
Upvotes: 1
Views: 292
Reputation: 610
If the issue is that it doesn't provide info/extract data it's because you missed a &
character after the callback parameter. Speaking of which, you have two callback parameters.
If the issue is that it returns an error instead of an object with a "query" key, that's probably because userSearch
was an empty string or something.
Upvotes: 1