如上,我没有用任何Ajax浏览器框架&服务器框架

解决方案 »

  1.   

    Ajax 序列化的 方法 出错是不给提示的 所以 你把代码 贴出来 让我们分析一下
      

  2.   

    <html>
    <head>
    <title></title>
    <script type="text/javascript">
    var xmlHttp;
    function createXMLHttpResponse()
    {
      if(window.ActiveXObject)
      {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      
      }
      else if(window.XMLHttpRequest)
      {
         xmlHttp=new XMLHttpRequest();
      } 
    }
    function formsubmit(param)
    {
       createXMLHttpResponse();
       if(param=="1")
       {
          url="PersonalPicture.aspx?UserID=52&flage=&IDLIST=";
       }
       else if(param=="2")
       {
         url="PersonalPicture.aspx?UserID=52&flage=Del&IDLIST="+b();
       }
       xmlHttp.onreadystatechange=handleStateChange;
       xmlHttp.open('get','url',true);
       
       //xmlHttp.setRequestHeader("If-Modified-Since","0");
       xmlHttp.send(null);
    }
    function handleStateChange()
    {
       if(xmlHttp.readyState==4)
       {
             alert(xmlHttp.statusText);
             var xmlobj=xmlHttp.responseXML;
             alert(xmlHttp.responseXML.xml);
             var elemDoc=xmlobj.getElementsByTagName("Album_Table");
             if(document.body.firstChild!=null)
            {
                document.body.removeChild(document.body.firstChild);
            }
            document.write('<form id="form" name="form" method="post" action="">');
            document.write('<table border="1">');
            document.write('<tr>');
            document.write('<td>ID</td>');
            document.write('<td>文件名</td>');
            document.write('<td>图片名</td>');
            document.write('</tr>');
            for(var i=0;i<elemDoc.length;i++)
            {
                var Album_Table=elemDoc[i];
                document.write('<tr><input  type="hidden" name="hiddenAlbum" value='+Album_Table.getElementsByTagName("ALBUM_ID")[0].firstChild.data+'>');
                document.write('<td><input type="checkbox" name="checkbox" id="ID_List" onclick="javascript:b()"></td>');
                document.write('<td>'+Album_Table.getElementsByTagName("ALBUM_NAME")[0].firstChild.data+'</td>');
                document.write('<td>'+Album_Table.getElementsByTagName("FILE_NAME")[0].firstChild.data+'</td>');
                document.write('</tr>');
            }
            document.write('</table>');
            document.write('<input type="button" onclick="formsubmit(2)">');
            document.write('</form>');
            document.close();
         }
      
    }
    </script>
    <script type="text/javascript">
    function a()
    {
       var obj=document.getElementsByTagName("input");
       var c=new Array();
       for(var i=0;i<obj.length;i++)
       {
           if(obj[i].checked==true)
           { 
                obj[i].value=obj[i-1].value;
                c[i]=obj[i].value;     }
       }
       return c;
    }
    function b()
    {
      var b=new Array();
      var string="";
      b=a();
      for(var j=0;j<b.length;j++)
      {
        if(b[j]==undefined)
        { 
           alert("dfs");
        }
        else
        {
           string=string+b[j]+",";
         }
      }
      return string;
    }
    </script>
    </head>
    <body onload="formsubmit(1)">
    <!--
    <form name="form" id="form">
    <table border="1">
    <tr>
    <td>
    <input type="hidden" name="hiddenAblum" value="1">
    <input type="checkbox" name="checkbox" onclick="b()" >
    </td>
    </tr>
    <tr>
    <td>
    <input type="hidden" name="hiddeAblum" value="2">
    <input type="checkbox" name="checkbox" onclick="b()">
    </td></tr>
    </table>
    </form>
    -->
    </body>
    </html>
      

  3.   

    aspx代码
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using AlbumManagement;public partial class PersonalPicture : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentType = "text/xml";
            string UserID = Request["UserID"].ToString();
            AlbumManagement.AlbumClass AlbumInfo = new AlbumManagement.AlbumClass();
            //Response.Write(AlbumInfo.AlbumList(Request["UserID"].ToString().Trim()));
            HttpContext.Current.Response.Write(AlbumInfo.AlbumList(Request["UserID"].ToString().Trim()));
            //HttpContext.Current.Response.Write(AlbumInfo.AlbumList("52"));
            Response.Flush();
            Response.End();
        }
    }
      

  4.   

    问题在这里:
    if(xmlHttp.readyState==4)
       {         alert(xmlHttp.statusText);         var xmlobj=xmlHttp.responseXML;
             alert(xmlHttp.responseXML.xml);是statusText引发了"Object Not Found", 在第一次看帖子时还以为是page not found, 
    LZ换成xmlHttp.status试试就应该好了,
    而且,不能光检测 readyState,应当还要检测status,即:
    if(xmlHttp.readyState==4 && xmlHttp.status == 200)
    {
      // your code here ...
    }
    status为200才能说明服务器正确返回了
      

  5.   

    你的"not found"是"object not found"不?
    如果是,把
    if(xmlHttp.readyState==4)
       {
             alert(xmlHttp.statusText);
             var xmlobj=xmlHttp.responseXML;
             alert(xmlHttp.responseXML.xml);
             //....
    }
    改成
    if(xmlHttp.readyState==4)
       {         alert("status:" + xmlHttp.status);         var xmlobj=xmlHttp.responseXML;
             alert("xml: " + xmlHttp.responseXML.xml);
             //.........
    }这样就能看出是哪一步出的问题了,如果这样改了有错,可能是第二步出错,不应当是第一步的
      

  6.   

    首先,检查你的cs文件是否返回了xml格式的内容
    再次,Album_Table.getElementsByTagName("ALBUM_ID")[0].firstChild.data.data??
    ~~~~~
      

  7.   

    我的readystate是4,就是完成
    statusText返回值我用alert(xmlhttp.statusText)弹出来
    .cs文件返回xml格式的内容
    .data??
    难道属性用错了吗
      

  8.   

    找到错误了,谢谢各位热心,TKS