I've just tried that and it gives the same result. The variable still isn't being set from inside the callback function.
let me illustrate what I mean:
Code:
window.arr = "something";
$.getJSON('../fxns/status.php',function(jsdata){ window.arr = "something else"});
alert(window.arr);
This still alerts "Something"
I also tried this
Code:
$.getJSON('../fxns/status.php',function(jsdata){ window.arr2 = "something else"});
alert(window.arr2);
This alerts "undefined".
Now, the $getJSON() is meant to return a XMLHttpRequest object, but for some reason it's properties are only accessible from inside the call back function, and I can't seem to assign the responseText to any variable outside it.
even
Code:
alert($.getJSON('../fxns/status.php').responseText);
alerts a blank dialog box.
Bookmarks