如题:
目前在开发的一个系统,使用了第三方报表控件,在执行增删改操作后,该控件返回给我的是一个.xml格式的文件(该控件只对客户端有效,无法在服务端直接获取),考虑使用ajax将该xml post到服务端,目前代码如下:function PostData(url,postedData)
{
    var xmlHttpRequest= CreateXmlHttpRequest();
   
    //调用encodeURI方法两次
    postedData = encodeURI(postedData);
    postedData = encodeURI(postedData);
    var url = url;   
    //向指定URL发送请求  true表示异步
    xmlHttpRequest.open("POST",url,true);
    //post提交设置项
    xmlHttp.setRequestHeader("content-type","text/xml");
    //设置一个回调的函数来处理返回的结果
    xmlHttpRequest.onreadystatechange=function(){CallBack(xmlHttpRequest)};
    xmlHttpRequest.send(postedData);
}
此处CreateXmlHttpRequest()以及 CallBack()是完全正确的代码。
该PostData()在aspx页面调用如下:      function GetChangedContent()
        {
           var postedData= document.forms[0].TL.func("GetChangedXML","2");           alert(postedData);
           PostData("F_CalcReport.aspx",postedData);
        }服务端获取代码如下:  private void ModifyData()
    {
        try
        {
            XmlDocument document = new XmlDocument();
            document.Load(Request.InputStream);
        }
        catch (Exception e)
        {
            Response.Write(e.Message);
        }
    }运行后抛出异常:根级别上的数据无效。 行 1,位置 1。经测试,弹出的格式满足要求
格式为<table level="2" key="Id" > other node... </table>
有人说此处无<? xml ... >,但我测试在ajax的send方法里,
将参数改为 xmlHttpRequest.send("<?xml version=\"1.0\" encoding=\"utf-8\" ?>
<TreeList><Cols><Col   name=\"SySID\" isKey=\"true\" >ID</Col>  </TreeList>");
后仍有同样错误
请高手就本人所写代码指点,或者提供成功ajax post xml 的案例。
谢谢