I'm trying to construct a simple jQuery function that fetches JSON data from a URL but I can't seem to get any output. Can anyone tell me where I'm going wrong?
<button id="test">Test</button>
$(document).ready(function() {
$("#test").click(function() {
$.getJSON('https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=revisions&rvprop=content&format=json', function(objDATA) {
document.write(objDATA);
console.log(objDATA);
});
});
});