国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > AJAX > 正文

ajax readyState的五種狀態詳解

2024-09-01 08:29:31
字體:
來源:轉載
供稿:網友
在《Pragmatic Ajax A Web 2.0 Primer 》中對readyStae狀態的介紹,摘譯如下:
0: (Uninitialized) the send( ) method has not yet been invoked.
1: (Loading) the send( ) method has been invoked, request in progress.
2: (Loaded) the send( ) method has completed, entire response received.
3: (Interactive) the response is being parsed.
4: (Completed) the response has been parsed, is ready for harvesting.
0 - (未初始化)還沒有調用send()方法
1 - (載入)已調用send()方法,正在發送請求
2 - (載入完成)send()方法執行完成,已經接收到全部響應內容
3 - (交互)正在解析響應內容
4 - (完成)響應內容解析完成,可以在客戶端調用了
對于readyState的這五種狀態,其他書中大都語焉不詳。像《Foundations of Ajax》中,只在書中的表2-2簡單地列舉了狀態的“名稱”--The state of the request. The five possible values are 0 = uninitialized, 1 = loading, 2 = loaded, 3 = interactive, and 4 = complete。而《Ajax in Action》中好像根本就沒有提到這5種狀態的細節。
《Professional Ajax》中雖不盡人意,但還是有可取之處:
There are five possible values for readyState:
0 (Uninitialized): The object has been created but the open() method hasn't been called.
1 (Loading): The open() method has been called but the request hasn't been sent.
2 (Loaded): The request has been sent.
3 (Interactive). A partial response has been received.
4 (Complete): All data has been received and the connection has been closed.
readyState有五種可能的值:
0 (未初始化): (XMLHttpRequest)對象已經創建,但還沒有調用open()方法。
1 (載入):已經調用open() 方法,但尚未發送請求。
2 (載入完成): 請求已經發送完成。
3 (交互):可以接收到部分響應數據。
4 (完成):已經接收到了全部數據,并且連接已經關閉。
在《Understanding AJAX: Using JavaScript to Create Rich Internet Applications》中,則用下表進行了說明:
readyState Status Code
Status of the XMLHttpRequest Object
(0) UNINITIALIZED 未初始化
The object has been created but not initialized. (The open method has not been called.)
(XMLHttpRequest)對象已經創建,但尚未初始化(還沒有調用open方法)。
(1) LOADING 載入
The object has been created, but the send method has not been called.
(XMLHttpRequest)對象已經創建,但尚未調用send方法。
(2) LOADED 載入完成
The send method has been called, but the status and headers are not yet available.
已經調用send方法,(HTTP響應)狀態及頭部還不可用。
(3) INTERACTIVE 交互
Some data has been received. Calling the responseBody and responseText properties at this state to obtain partial results will return an error, because status and response headers are not fully available.
已經接收部分數據。但若在此時調用responseBody和responseText屬性獲取部分結果將會產生錯誤,因為狀態和響應頭部還不完全可用。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 施甸县| 海晏县| 德庆县| 涞源县| 田林县| 平湖市| 虹口区| 招远市| 岑溪市| 鄂州市| 吐鲁番市| 迭部县| 南雄市| 江达县| 左云县| 喀喇| 游戏| 惠水县| 万年县| 乐亭县| 烟台市| 类乌齐县| 斗六市| 翁源县| 年辖:市辖区| 永川市| 南阳市| 泸州市| 大田县| 南岸区| 新泰市| 乌鲁木齐县| 工布江达县| 讷河市| 武强县| 洪雅县| 兰西县| 濮阳市| 赤峰市| 鲁甸县| 漾濞|