<script type="text/javascript">
var xmlHttp;
//創建一個XmlHttpRequeset對象
function createXMLRequest()
{
if (window.XMLhttpRequest)
{
xmlHttp = new XMLhttpRequest();
}
else if (window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
//開始一個請求
function startRequest()
{
createXMLRequest();
xmlHttp.onreadyStateChange = handlestatechange;
xmlHttp.open();
xmlHttp.send();
}
function handlestatechange()...{
if(xmlHttp.readyState == 4)...{//描述一種"已加載"狀態;此時,響應已經被完全接收。
if(xmlHttp.status == 200)...{//200表示成功收到
alert("The Server Replied with:" + xmlHttp.responseText)
}
}
}
</script>