xmlhttp對象直接get壹個aspx程序
if(window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
try
{
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET","checkuser.aspx?uname=abc&pwd=123",false);
xmlHttp.setRequestHeader("If-Modified-Since","0");
xmlHttp.send(null);
if (xmlHttp.status == 200 || xmlHttp.status == 0)
{
htmlstr=xmlHttp.responseText;
// 解析壹下這個串,找出xml裏的成功失敗。
alert(htmlstr);//這裏能獲取htmlstr
}
}
catch(exception)
{
alert("您要訪問的資源不存在!");
}