简体   繁体   中英

How is xmlhttp.responseText assigned before xmlhttp.send()

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!

You need to look into closures.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM