https://codepen.io/robertmaples/pen/NvWydm?editors=1011
Hey guys,
I’m having trouble with my getJSON method. I’ve tested the url, search value, and click function - they’re all behaving as expected (I believe), but I can’t seem to get my JSON data to return. I have a feeling I’m missing something obvious, but any help would be greatly appreciated.
$(document).ready(function() {
var search;
$("#search-button").on("click", function(event) {
if ($("#search-box").val()) {
search = $("#search-box").val();
$.getJSON(
"https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&rvsection=0&titles=" +
search,
function(data) {
console.log("JSON data: " + JSON.stringify(data));
}
);
}
});
});