function send_Request()
{
var http_request = new ActiveXObject("Microsoft.XMLHTTP");
http_request.open("POST","/AJAXExample/process.jsp",true);
http_request.send("num1=10&num2=23");
}
这段代码发到服务器端,没能用request.getParameter("num1");方法取到num1,num2参数值,请各位高手赐教

解决方案 »

  1.   

    AJAX中的XMLHttpRequest对象的问题
      

  2.   

    post提交的时候send方法使用错误
      

  3.   

    给个例子:  
    function createXMLHttpRequest(){
             if (window.ActiveXObject){
              xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    else if(window.XMLHttpRequest){
                     xmlHttp = new XMLHttpRequest();
                    }
            }
           
            function sendRequest(pageIndex){
             createXMLHttpRequest();
      //处理方法
                    var url;
                    var index=pageIndex-1;
                    var xml=document.getElementById("textarea" + pageIndex).value;
                    currPageIndex=pageIndex;
                    url=uris[index]+"?transType="+transtypes[index]+"&transMessage="+xml+"&timeStamp="+ new Date().getTime();
                    xmlHttp.open("POST",url,true);
                    xmlHttp.onreadystatechange = handleStateChange;
                    xmlHttp.send();
            }
            
            //回调方法
            function handleStateChange(){
             if (xmlHttp.readyState == 4){
              if (xmlHttp.status == 200){
             //返回结果
            document.getElementById("textarea"+currPageIndex+currPageIndex).value=xmlHttp.responseText;
                            }
                    }
            }
      

  4.   

    全局变量:
     tabCount = 7;
        var xmlHttp;
        var currPageIndex;
        var uris=["tc1.do","tc2.do","tc3.do","tc4.do","tc5.do","tc6.do","tc7.do"];
        var transtypes=[101,102,103,104,105,106,107];
      

  5.   

    上面的问题解决了没?
    我想说一下就是如果你是POST提交的话最好要设置一下
    XMLHttpRequest对象的请求头
    var http_request = new ActiveXObject("Microsoft.XMLHTTP");
    http_request.open("POST","/AJAXExample/process.jsp",true);
    http_request.setRequestHeader("Content-Type', 'application/x-www-form-urlencoded');
    http_request.send("num1=10&num2=23");
    这样我想就应该可以得到了