使用xmlHttp.responseText总是出错???

来源:百度知道 编辑:UC知道 时间:2024/09/24 15:18:22
自己写的XMLHTTPRequest请求,请求返回的responseText用alter可以显示的出来,而且是整个反应页面的内容,使用p1.innerHTML=xmlHttp.responseText;就总是报错,怎么回事呢?
我的代码是:
function xmlHttpOpen(Method,Url,bAsync)
{
xmlHttp.open(Method,Url,bAsync);
xmlHttp.onreadystatechange = UpdatePage;
xmlHttp.Send(null);
}
function Button1_onclick() {
xmlHttpOpen("GET","AjaxResponse.aspx",true);
}
function UpdatePage()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
p1.innerHTML=xmlHttp.responseText;
}
else if(xmlHttp.status==404)
alert("页面没找到");
}
}
IE报的错,运行时的未知错误

后台代码执行完之后调用Response.End()方法
这样就不会输出页面的代码了
因为得到的是整个页面的代码,所以前台使用innerHTML会报错

报的错是什么?