var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var xmldoc = new ActiveXObject("Msxml.DOMDocument");
xmlhttp.Open("POST","insertdata.aspx",false);
xmlhttp.Send("aa=123");
xmlhttp.onreadystatechange=function() {
               if (xmlhttp.readyState==4) {
                  alert(xmlhttp.responseText)
               }
        }
if(xmlhttp.status!=200)
alert ('网络故障(xmlhttp.status='+xmlhttp.status+'),请稍后再试!');
var aaaa = xmlhttp.responseText;
alert(aaaa);
我在insertdata.aspx页面里用string aa=Request["aa"].ToString ();取不到数据,用GET
方法的话就行。不知道怎么处理。

解决方案 »

  1.   

    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    var xmldoc = new ActiveXObject("Msxml.DOMDocument");
    xmlhttp.Open("POST","insertdata.aspx?aa=123",false);
    xmlhttp.Send(null);
    xmlhttp.onreadystatechange=function() {
                   if (xmlhttp.readyState==4) {
                      alert(xmlhttp.responseText)
                   }
            }
    if(xmlhttp.status!=200)
    alert ('网络故障(xmlhttp.status='+xmlhttp.status+'),请稍后再试!');
    var aaaa = xmlhttp.responseText;
    alert(aaaa);
      

  2.   

    to :swordragon这样子是行,但是我想知道xmlhttp.Send("aa=123");这样传过去,insertdata.aspx怎么样接收数据
    string aa=Request["aa"].ToString ();这样子不行。
    以下是从别的贴子上看到的:那简单呀:
    xh.open("mm.asp?id=123", "get", false); xh.send(null);
    服务器端用 request.querystring("id") 取得值去查数据库即可。或者
    xh.open("mm.asp", "post", false); xh.send("id=123");
    服务器端用 request.form("id") 取得值去查数据库即可。
      

  3.   

    xmlhttp.Open("POST","insertdata.aspx?",false);<--在文件名后面加个问号也行.
      

  4.   

    难道send的参数一定要是null吗。
      

  5.   

    这样send()也行,但OPEN中的URL要象swordragon般写全.