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
});
});