服务器返回的数据与XMLHttpRequest接收到的数据怎么不一样啊?
客户端脚本
<script language= "javascript " type= "text/javascript ">
function GetAjaxValue(url)
{
var randomNum = Math.random();
var objXMLHttp;
if(window.ActiveXObject)
{
xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP ");
}
else if(window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
xmlHttp.Open( "GET ",url,false);
xmlHttp.Send(null);
var returnValue;
if(xmlHttp.readyState == 4)
{
if(xmlHttp.status == 200)
{
returnValue = xmlHttp.responseText;
}
else
{
returnValue = xmlHttp.responseText;
}
}
else
{
returnValue = xmlHttp.responseText;
}
return(returnValue);
}
var url = "../SetSession.aspx ";
window.open( '../SetSession.aspx ', 'test ', 'width:1200px;height:700px ');
var temp = GetAjaxValue(url); </script>
服务端代码
protected void Page_Load(object sender, EventArgs e)
{
try {
// 执行相关操作
Response.Write(( "true "));
}
catch (Exception ex) {
Response.Write(ex.Message);
}
finally {
Response.End();
}
}
window.open( '../SetSession.aspx ', 'test ', 'width:1200px;height:700px ')
返回的是true
可是temp 是页面出错信息的一大堆代码,而且中文都是乱码不知道是什么错误
请帮忙看一下
谢谢
[解决办法]
up