求助 使用AJAX时遇到的问题
试列代码:
havetalk.aspx页面
protected void Page_Load(object sender, EventArgs e)
{
cookie = Request.Cookies[ "UserLogin "];
string sName = cookie.Values[ "MyName "].ToString();
//string sName = "李四 ";
if (Application[sName] == null)
{
Response.Write( "Hello \n ");
Response.End();
}
else
{
string sMessage = Application[sName].ToString();
Response.Write(sMessage);
Response.End();
}
}
客户端代码
var xmlRequest;
var Message;
function createRequest()
{
if(window.ActiveXObject)
{
xmlRequest=new ActiveXObject( "Microsoft.XMLHttp ");
}
else if(window.XMLHttpRequest)
{
xmlRequest=new XMLHttpRequest();
}
}
function getMessage()
{
createRequest();
xmlRequest.open( "GET ", "havetalk.aspx ",true);
xmlRequest.onreadystatechange=docallback;
xmlRequest.send(null);
}
function docallback()
{
if(xmlRequest.readystate==4)
{
if(xmlRequest.status==200)
{