Currently attempting to retrieve a JSON formatted file and store it in a JS variable (the json file is properly formatted).
var data;
$.getJSON('../data/data.js', function(json){
data = json;
});
console.log(data);
The output is as follows:
undefined
Interestingly, when I use console.log inside the $.getJSON
function, I do receive the desired results.
Any insights on what could be going wrong here?