So, here's the code
$(document).ready(function (){
$.get("json_family.php", {}, function(data) {
families = data;
}, 'json');
console.log(families);
// Some other codes here
});
And here's what happens when I try to run it:
Uncaught ReferenceError: families is not defined
So, what gives? I thought variables declared without the var
keyword would be global no matter where it is declared.