I am sure I am missing something obvious, but whatever it is I can't seem to figure it out.
Here is what I have
var warr = new Array();
$('#step3next').click(function() {
$.post('AJAX_GetGameWords.asp',function(data) {
fw(data.warray);
},"json");
$('.vardisplay3').append(warr+'');
});
function fw(x) {
warr = [x];
}
Ultimately what I am wanting is to be able to use the warr array anywhere.
If I put the $('.vardisplay3').append(warr+''); just under fw(data.warray); then it works just fine and displays in .vardisplay3, but with where it is now, it doesn't display anything.
I would think since warr is set as global, it would work, but I am obviously missing a scope issue or something.
Can anyone explain what is going on and how can I have the ability to use the warr array anywhere.
Thanks
$.postcallback function doesn't run until at least after the current function call stack is cleared.