[thelist] JavaScript variable scope wrong?

Paul Waring paul at xk7.net
Wed Aug 3 09:49:06 CDT 2005


On Wed, Aug 03, 2005 at 02:40:23PM +0100, Mark Rees wrote:
> This is an async request (that's what the true is doing). This may or may
> not be related to the problem - it's possible that if you do it
> synchronously, the rest of the code will wait until the resource is
> returned. It might be worth reading up on this.

Ok, I understand what you mean by that. I've changed the req.open("GET",
url, true) to req.open("GET", url, false) though and it doesn't seem to
have made any difference - the first alert still reports response as
being undefined. In fact, if I use true for the third parameter
Firefox/Mozilla will load the XML (or at least I can trigger an alert()
one statement before response = req.responseXML.documentElement) but
won't set response in time. If I set it to false, it won't load the XML
at all. IE on the other hand doesn't seem to care whether I set it to
true or false and will load the XML properly regardless.

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk


More information about the thelist mailing list