1.建立連接 :
XMLHttpReq=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Msxml2.XMLHTTP");
2.發送請求:
XMLHttpReq.open("GET",url,true);
3.返回請求:
XMLHttpReq.onreadystatechange=function()
{
???if(XMLHttpReq.readystate==4)
???{
??????if(XMLHttpReq.status==200)
??????{
?????????updateObj();
??????}
??????else
??????{
?????????alert("error:"+XMLHttpReq.status);
??????}
???}
}
4.頁面取數據:
var resCode=XMLHttpReq.responseXML.getElementByTagName("code");