More information about the Underscore mailing list

[_] jQuery losing the scope!

Jon Bennett jmbennett at gmail.com
Tue Dec 8 20:08:19 GMT 2009

Hi JP,

> Online 61 and 67 you can see that the result of the ajax call is setting
> a flag var called 'vid_bg_img'. The problem is that outside of the ajax
> call line 74 the value is only correct when running the code for a
> second time.

I _think_ it could be that your code will run regardless of the AJAX
call, eg, there's nothing to stop it getting to the alert(vid_bg_img)
before the ajax completes. If you stick the code into the 'success'
handler of the ajax call, that may fix it.

hth

Jon


-- 
jon bennett - www.jben.net - blog.jben.net