小弟初学ajax,在前台使用了它向后台发送请求验证登录时用户名是否正确,正确以后使用response.redirect跳转到其他页面,调试的时候报了异常: 
Sys.WebForms.PageRequestManagerParserErrorException:The message received from the server could not be parsed.
前台代码:var XmlHttp;
   //创建XMLHTTP对象
   function createXMLHttpRequest()
   {     
      try //IE浏览器
      {
         XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");       
      }
      catch(e)
      {
         try 
         {
            XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
         }
         catch(oc)
         {
            XmlHttp = null;
         }
      }
      
      if (!XmlHttp && typeof XMLHttpRequest != "undefined")//FF浏览器
      {
         XmlHttp = new XMLHttpRequest();
      }
      return XmlHttp;
   }   //发送HTTP请求
   function SendRequest(url, funcName)
   {
      createXMLHttpRequest();
      XmlHttp.onreadystatechange = funcName;
      XmlHttp.open("GET", url, true);
      XmlHttp.send(null);
   }
 
   function GetBackInfor()
   {
      var temp;
      if (XmlHttp.readyState == 4)
        {
           if (XmlHttp.status == 200)
           {
              temp = (XmlHttp.responseText).charAt(0); //获取第一个字符  
            }
         }
      return temp;
   }
 
   //检查用户输入的会员名,确保其非空并存在
   function LoginNameCheck(name)
   {
      var userName = name.value;
      if (userName == "")
      {
         document.getElementById("msgLoginName").innerHTML = "<font color='Red'>会员名不能为空!</font>";
         return false;
      }
      else
      {
         var url = "RegisterCheck.aspx?loginName=" + escape(userName);
         SendRequest(url, handleLoginNameCheck);
      }
   }
   
   //处理服务器回传的会员名消息
   function handleLoginNameCheck()
   {
      var nameinfo = document.getElementById("msgLoginName");//当正在查询时
      nameinfo.innerHTML = "正在检查用户名,请稍后...";
      var infor = GetBackInfor();
      if (infor == "0") //用户名不存在
      {
         nameinfo.innerHTML = "<font color='Red'>╳ 您输入的用户名不存在。</font>";          
      }
      else
      {
         nameinfo.innerHTML = "<font color='Green'>√</font>";
      }
   }
大家帮我解答下......谢谢了
    

解决方案 »

  1.   

    //处理服务器回传的会员名消息
       function handleLoginNameCheck()
       {
          var nameinfo = document.getElementById("msgLoginName");//当正在查询时
          nameinfo.innerHTML = "正在检查用户名,请稍后...";
          var infor = GetBackInfor();
          if (infor == "0") //用户名不存在
          {
             nameinfo.innerHTML = "<font color='Red'>╳ 您输入的用户名不存在。</font>";          
          }
          else
          {
             nameinfo.innerHTML = "<font color='Green'>√</font>";
             //在这里跳 window.open("我跳");
          }
       }
      

  2.   

    function SendRequest(url, funcName)
       {
          createXMLHttpRequest();
          XmlHttp.onreadystatechange = funcName;//这里要写下面那个函数的名字
          XmlHttp.open("GET", url, true);
          XmlHttp.send(null);
       }
     
       function GetBackInfor()
       {
          var temp;
          if (XmlHttp.readyState == 4)
            {
               if (XmlHttp.status == 200)
               {
                  temp = (XmlHttp.responseText).charAt(0); //获取第一个字符  
                 //在这里接收完成后指定跳转
                window.location.href="xxx.aspx"

                }
             }
          return temp;
       }
      

  3.   


    function SendRequest(url, funcName)
       {
          createXMLHttpRequest();
          XmlHttp.onreadystatechange = funcName;
          XmlHttp.open("GET", url, true);
          XmlHttp.send(null); 
    document.write(XmlHttp.responseText);//或把此值赋给一页面html控件如div
       }
    RegisterCheck:
    Response.Write("<script language=javascript>window.location.href='要转向的地址';</script>");
    Response.End();
      

  4.   

     window.location.href="xxx.aspx"[/color]
      

  5.   

    你用ajax往aspx页面发东西 确定他能处理么  
    这个貌似要用一般处理页面 ashx
    在回调函数里头 给他跳转也可以啊
    window.location.href="xxx.aspx"[/color]
      

  6.   


    后台条转不了,如果想执行其他页面的话,可以使用Server.Execute("xxx.aspx")
      

  7.   

    用js异步请求页面时 必须返回数据 然后在js中操作