JSFiddle - React, Tailwind, and code Playground
HTML
<p>check out your console.</p>
JavaScript
window.jsonData = '{"dataCallback":[{"key":"val"}]})';
$(function() {
//var earnings = eval(window.jsonData);
//var earnings = JSON.parse(window.jsonData);
//console.log(earnings);
console.log(window.jsonData);
/*
// ajax in data
$.ajax({
type: 'GET',
dataType: 'jsonp',
cache: true, jsonp: false, jsonpCallback: 'dataCallback',
url: '', // normally something.json (a local json file), but in this case the source is a global variable (window.jsonData)
processData: false
}).complete(function(data) {
console.log(data);
// need to assign the "window.jsonData" to "data"
});
*/
});