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> 

 

你可能感兴趣的:(Ajax,function,职场,休闲)