Help with wikipedia viewer challenge

Hey Guys! I am having a bit of a challenge with my Wikpedia viewer. Cant get the API to work. Would appreciate any help and possible solutions. Thank you

Javascript Code:

$(document).ready(function(){
//“https://en.wikipedia.org/w/api.php?action=opensearch&search=&callback=?"
$(”#search").click(function(){

var searchItem = $("#searchItem").val();

 $.ajax({
  url: "https://en.wikipedia.org/w/api.php",
  dataType: "json",
  data: {
    action: "opensearch",
    format: "json",
    origin: "*",
    search: searchItem,
    formatversion: "2", 
    success: function(data){
    console.log(data); 
    },
    error: function(errorMsg) {
     alert("Error");
    }

 }

});
//Enter Keyboard click
});

});

The success and error functions shouldn’t be inside the data object.

Thank you so much guys, but after making the changes API call is still not working and I keep getting this error logged on my Web Console (Firefox):

“An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can remove its sandboxing”

Dont understand what it means. Thanks again guys

Thank you so much SkyC, returning API calls now. You have been extremely helpful, cant thank you enough. God bless you.