是什么在XMLHtt prequest不同readystates的意思,我如何使用它们? [英] What do the different readystates in XMLHttpRequest mean, and how can I use them?

查看:265
本文介绍了是什么在XMLHtt prequest不同readystates的意思,我如何使用它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

XMLHtt prequest 有5 的readyState s,而我只用1人(最后一个, 4 )。

XMLHttpRequest has 5 readyStates, and I only use 1 of them (the last one, 4).

什么是别人的,什么实际应用中,我可以使用他们?

What are the others for, and what practical applications can I use them in?

推荐答案

的readyState 值的完整列表是:

State  Description
0      The request is not initialized
1      The request has been set up
2      The request has been sent
3      The request is in process
4      The request is complete

(从<一个href="http://www.w3schools.com/ajax/ajax_xmlhtt$p$pquest_onreadystatechange.asp">http://www.w3schools.com/ajax/ajax_xmlhtt$p$pquest_onreadystatechange.asp)

在实践中,你几乎从来不使用其中任何一个,除了4。

In practice you almost never use any of them except for 4.

部分的XMLHtt prequest实现可以让你看到部分收到的答复的responseText 的readyState == 3 ,但这不是普遍支持,因此不应依赖。

Some XMLHttpRequest implementations may let you see partially received responses in responseText when readyState==3, but this isn't universally supported and shouldn't be relied upon.

这篇关于是什么在XMLHtt prequest不同readystates的意思,我如何使用它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆