[jQuery] assigning data from $.getJSON() to a global variable?

[jQuery] assigning data from $.getJSON() to a global variable?


Hi,
Is there a way to take the JSON from a $.getJSON() call and assign it
to a var in the global scope?
i tried the following but it didn't work:
var globalX;
function foo() {
$.getJSON("jsondata.js",function(data){
globalX = data;
});
}
thanks