Could someone please explain why this response isn't displaying on the page?
$.ajaxPrefilter( function (options) {
if (options.crossDomain && jQuery.support.cors) {
var http = (window.location.protocol === 'http:' ? 'http:' : 'https:');
contentType: 'application/json; charset=utf-8',
options.url = http + '//cors-anywhere.herokuapp.com/' + options.url;
//options.url = "http://cors.corsproxy.io/url=" + options.url;
}
});
$.get(
'https://data.nba.com/data/v2015/json/mobile_teams/nba/2017/scores/gamedetail/0011700003_gamedetail.json',
function (data) {
console.log("THE RESPONSE ", data);
setTimeout(function(){
$("#viewer").html(data);
}, 4000);
});
HTML
<div id="viewer"></div>
https://jsfiddle.net/nolaandy/df0jsdL0/1/
In the provided JSFiddle, a JSON object is logged in the console. Despite trying to display the entire response in the "viewer" div, nothing appears. What could be causing this issue?