readyState的值为什么不变化
var xmlHttp;function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
}
function doSearch(){
createXMLHttpRequest();
xmlHttp.onreadystatechange=handleStateChange;
var url="/wms/wmtsppdmul.html?method=ajax";
alert(xmlHttp.readyState);
xmlHttp.open("GET",url,true);
alert(xmlHttp.readyState);
xmlHttp.send();
alert(xmlHttp.readyState);
}
function handleStateChange(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
clearPreviousResults();
parseResults();
}
}
}
我用alert()打印发现readyState的值只有0,1后面的怎么没有出来?请高手帮忙看看,在线等!!!!