reading data from json file .... confusion
Hi Folks,
i followed a forum thread regarding fetching data from a json file...
i kind of rebuild the solution but have issues to get it to work the way i want.
i'm totally new to actionscript, so i don't understand what i'm missing here...
it works when i want to read the variable testList from an event function.
$.ajax({
type: 'GET',
url: 'myData.json',
dataType: 'json',
success: function (json) {
testList = json;
},
error: function() {
console.log("error");
}
});
// mouse over event
function mouseOverBtn(event)
{
console.log(testList);
} testList --> Object --> works fine
But as soon as i try to read it outside an event function, the variable is empty
$.ajax({
type: 'GET',
url: 'myData.json',
dataType: 'json',
success: function (json) {
testList = json;
},
error: function() {
console.log("error");
}
});
console.log(testList);testList --> null
what can i do to get the data outside of an event function?
