So I am having troubles understanding passing JSON data.
function getFooterContent(){
//ajax call to get json file
$.getJSON("scripts/pageData/footer/footerData.json", function(jsonData){
console.log(jsonData);
return jsonData;
}).fail(function(){
console.log("fail");
return -1;
});
//Return the json file
}
function someFunction(){
var someContent = new Object();
someContent = getFooterContent();
console.log(someContent);
}
So right now I'm calling a JSON file. And when I console.log(jsonData) I get an Object, which is what I want. So then I can someContent.theContent. Though when the jsonData is returned to the someFunction and I console.log(someContent) I get undefined. I don't understand, I thought it would be an object like it is in the getJSON function.