Wikipedia API returning a string, not JSON object

Wikipedia API returning a string, not JSON object


here is my project

when i try to run the ajax call to the wiki api i seem to be receiving a string instead of an object. Prior to this i was getting an error that was resolved when i removed “dataType: ‘json’” so im assuming that error was because the api was never sending me a json file in the first place? Can someone help me understand this a little more intimately. Why am i not receiving a json object? why am i not allowed to specify “dataType: ‘json’” without receiving this error: SyntaxError: Unexpected token / in JSON at position 0. Am i missing an important detail about how API’s and ajax requests work that i should read up on? Please share any documentation :slight_smile:
Here is my ajax request:

function userWiki(search){
var wikiEndPoint = ""
var url = “/w/api.php?action=opensearch&format=json&origin=*&search=” + search + “&warningsaserror=1&callback=data”;
url: wikiEndPoint + url,
success: function( data ) {
error: function(xhr, status, error) {
console.log("status: " + status);
console.log("error: " + error);
console.log("xhr: " + xhr);
cache: false //this is important