[jQuery] Re: Callback-return into global variable

2008-01-19 Thread J Moore
Couple of thoughts: 1) $.each() is not for moving through an array. (is for doing something to each matched DOM element) try: for(item in _json) { alert('item:'+item);} 2) try defining your global as an object. e.g. var _json = {}; -jason On Jan 16, 2:17 am, Niels [EMAIL PROTECTED] wrote:

[jQuery] Re: Callback-return into global variable

2008-01-19 Thread Danny
$.getJSON and all the AJAX functions are asynchronous; the function returns before it gets any result. That's why there's a callback function: it gets called when the data are available. So when you write load_comments(); $.each(_json.comments, function(comment) {