function Post(Price,Year,Month,FoPcs,Curr,PKID,ProID,RealRS,SDDC)
{
var str;
str='Price='+Price;
str=str+'&Year='+Year;
str=str+'&Month='+Month;
str=str+'&FoPcs='+FoPcs;
str=str+'&Curr='+Curr;
str=str+'&PKID='+PKID;
str=str+'&ProID='+ProID;
str=str+'&RealRS='+RealRS;
str=str+'&SDDC='+SDDC;var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
var xmldoc = new ActiveXObject("Msxml.DOMDocument");
xmlhttp.Open("POST","PostForecast.aspx",false);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlhttp.Send(str);xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.responseText)
}
}
if(xmlhttp.status!=200)
  {
     alert ('网络故障(xmlhttp.status='+xmlhttp.status+'),请稍后再试!');
     return false;
}       
var info = xmlhttp.responseText;
info=info.substr(0,(info.indexOf('<!')));
if(info.indexOf('成功')>0)
  {
    window.opener=null;window.returnValue =1;window.close()
}
  alert(info);
}

解决方案 »

  1.   

    如果得到data的值,data不是自己送的吗?
      

  2.   

    debug不就知道情況了
    我在發xml前會先把左尖括號替換掉,server接收了再替換回來。
    因爲不想去掉安全驗證,笨方法哦
    lz有可能會遇到這個問題的
      

  3.   

    //====================================================================
        function GetDataFromServer(url,data)
    {

    var xmlHttp = getXmlHttp() ;
    var serverUrl = url ;
    if(xmlHttp)
    {
        window.status = "数据更新中...." ;
        xmlHttp.open("post",serverUrl,true) ;
        xmlHttp.setrequestheader("content-type","application/x-www-form-urlencoded") ;
        xmlHttp.send(data) ;
        xmlHttp.onreadystatechange = function()
    {
    if(xmlHttp.readyState == 4)
    {
    if(xmlHttp.status == 200)
    {    
        window.status = "数据更新完成" ;
        //var result =  xmlHttp.responseText ;
        
        //if(document.getElementById("load_"+id))
                            //{
    // document.getElementById("load_"+id).style.display='none';
    // document.getElementById("node"+id).innerHTML+=result ;
                            //}
                            //document.getElementById("hello").innerHTML=result;
        
    }
    }
    }
    }
    }

    function GetNodeInfo(xmlData)
    {
       var url = "WebForm9.aspx";
       GetDataFromServer(url,xmlData) ;
    }

    function getXmlHttp()
    {

    var obj = null ;
    try
    {
    obj = new ActiveXObject("Msxml2.XMLHTTP") ;
    return obj ;
    }
    catch(e)
    {
    try
    {
    obj = new ActiveXObject("Microsoft.XMLHTTP") ;
    return obj ;
    }
    catch(o)
    {
    obj = null ;
    }
    }

    return null ;
    }
        //====================================================================  //============================调用
         
           GetXml();
           hellodata=document.getElementById("myXml").value;
           if(hellodata)
           //debugger
          
           GetNodeInfo(hellodata);
            //============================public class WebForm9 : System.Web.UI.Page
    {
    private void Page_Load(object sender, System.EventArgs e)
    {
    try
    {
    System.IO.Stream stream = Request.InputStream;
    //string xmlString = Request["data"].ToString();
    //XmlDocument layout = new XmlDocument();
    System.Xml.XmlDocument layout = new XmlDocument(); 
    try
    {
    layout.Load(stream);
    layout.Save(Server.MapPath("layout/yyy.xml"));
    }
    catch
    {
    ;
    }
    //string xmlString=layout;//stream.ToString();
    OperateFile fileOp=new OperateFile();
    try
    {
    if(fileOp.WriteFile(Server.MapPath("layout/yyy.xml"),"yyy_"))
    Response.Write("<script>alert('保存成功!')</script>") ;
    }
    catch(Exception ex)
    {
    string str=ex.Message;
    } Response.Clear();
    Response.Write(stream.ToString());
    Response.End();
    }
    catch(Exception sysException)
    {
    }
    }
      

  4.   

    先确认JavaScript是否已经提交了数据,可以使用alert()方式确定程序流程
    根据你的情况应该是javascript没有提交数据。
      

  5.   

    alert(data)表示已经向服务端提交了,可是webform9.aspx没处理
      

  6.   

    webform9.aspx 接收到data了吗