简体   繁体   English

如何在xmlhttp.send()之前分配xmlhttp.responseText

[英]How is xmlhttp.responseText assigned before xmlhttp.send()

Newbie ajax question from this example : 此示例中的新手ajax问题:
How is xmlhttp.responseText assigned before xmlhttp.open() and xmlhttp.send() ? 如何在xmlhttp.open()和xmlhttp.send()之前分配xmlhttp.responseText? (If we need the data from demo_post.asp) (如果我们需要来自demo_post.asp的数据)

I understand it is in the onreadystatechange but if the javascript is read from top down I do not understand. 我了解它是在onreadystatechange中,但是如果从上至下读取javascript,我将无法理解。 Thanks, and go easy on me! 谢谢,别客气!

You need to look into closures. 您需要研究闭包。

onreadystatechange is getting assigned a function. onreadystatechange被分配了一个功能。 That function is not called immediately...look at its name. 不会立即调用该函数...请看它的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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