ajax1

<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> 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章