
XMLHTTP對象參考
XMLHttpRequest
提供客戶(hù)端同http服務(wù)器通訊的協(xié)議
Example
下面的代碼是在JScript中創(chuàng )建一個(gè)XMLHTTP對象并從服務(wù)器請求一個(gè)XML文檔。服務(wù)器返回XML文檔并顯示。
var xmlHttpReq = new ActiveXObject("MSXML2.XMLHTTP.3.0");xmlHttpReq.open("GET", "http://localhost/books.xml", false);xmlHttpReq.send();alert(xmlHttpReq.responseText);在非IE的瀏覽器中,需要用new XMLHttpRequest()來(lái)創(chuàng )建對象,如下:
var xmlHttpReq = new XMLHttpRequest();xmlHttpReq.open("GET", "http://localhost/books.xml", false);xmlHttpReq.send();alert(xmlHttpReq.responseText);vbscript:
Dim HttpReq As New MSXML2.XMLHTTP30HttpReq.open "GET", "http://localhost/books.xml", FalseHttpReq.sendMsgBox HttpReq.responseText
備注
客戶(hù)端可以通過(guò)XmlHttp對象(MSXML2.XMLHTTP.3.0)向http服務(wù)器發(fā)送請求并使用微軟XML文檔對象模型Microsoft® XML Document Object Model (DOM)處理回應。


