欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript ajax功能函數(shù)

 更新時(shí)間:2009年12月18日 00:59:36   作者:  
javascript ajax功能函數(shù),沒用過的朋友看看代碼,應(yīng)該會(huì)有點(diǎn)收獲。
復(fù)制代碼 代碼如下:

//ajax測(cè)試
var xmlHttp;
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
}
function a(){
createXMLHttpRequest()
url="${request.contextPath}/test/forMain.action";
alert(url);
statechange;
xmlHttp.open("GET",url,true);
xmlHttp.Send(null);
alert(xmlHttp.responseText);
}
function statechange(){
alert(xmlHttp.status);
if(xmlHttp.readyState == 4){//描述一種"已加載"狀態(tài);此時(shí),響應(yīng)已經(jīng)被完全接收。
if(xmlHttp.status == 200){//200表示成功收到
alert("成功");
return xmlHttp.responseText; //返回值
}
else{
alert("失敗");
}
}
}

相關(guān)文章

最新評(píng)論