views:

38

answers:

1

Newbie ajax question from this example:
How is xmlhttp.responseText assigned before xmlhttp.open() and xmlhttp.send() ? (If we need the data from demo_post.asp)

I understand it is in the onreadystatechange but if the javascript is read from top down I do not understand. Thanks, and go easy on me!

+2  A: 

You need to look into closures.

onreadystatechange is getting assigned a function. That function is not called immediately...look at its name.

Jack