request|xml|XMLhttprequest|對象
Common XMLHttpRequest Object Methods
Method
Description
abort()
Stops the current request
getAllResponseHeaders()
Returns complete set of headers (labels and values) as a string
getResponseHeader("headerLabel")
Returns the string value of a single header label
open("method", "URL"[, asyncFlag[, "userName"[, "passWord"]]])
Assigns destination URL, method, and other optional attributes of a pending request
send(content)
Transmits the request, optionally with postable string or DOM object data
setRequestHeader("label", "value")
Assigns a label/value pair to the header to be sent with a request
常用的XMLHttpRequest對象屬性
屬性
描述
onreadystatechange
每次狀態改變所觸發事件的事件處理程序
readyState
對象狀態值:
- 0 = 未初始化(uninitialized)
- 1 = 正在加載(loading)
- 2 = 加載完畢(loaded)
- 3 = 交互(interactive)
- 4 = 完成(complete)
responseText
從服務器進程返回的數據的字符串形式
responseXML
從服務器進程返回的DOM兼容的文檔數據對象
status
從服務器返回的數字代碼,比如404(未找到)或200(就緒)
statusText
伴隨狀態碼的字符串信息