首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

服务器端怎么读取XML请求

2012-02-06 
服务器端如何读取XML请求 - Web 开发 / Ajax.JS文件,我该在服务器端如何接收到userID这个值,急!!!!!在线等

服务器端如何读取XML请求 - Web 开发 / Ajax
.JS文件,我该在服务器端如何接收到userID这个值,急!!!!! 在线等

  var userID = document.getElementById("txtID").value;
   
  var xmlString = "<profile>" +
  "<userID>" + escape(userID) + "</userID>" +
  "</profile>";

  // Build the URL to connect to
  var url = "TempXMLRequest.aspx";

  // Open a connection to the server
  xmlHttp.open("POST", url, true);

  // Tell the server you're sending it XML
  xmlHttp.setRequestHeader("Content-Type", "text/xml");

  // Set up a function for the server to run when it's done
  xmlHttp.onreadystatechange = confirmUpdate;

  // Send the request
  alert(xmlString);
  xmlHttp.send(xmlString);


[解决办法]
再封装一次
xmlString = "xml="+xmlString
然后发送,后台request("xml")接着在服务器端建立一个xml对象,然后加载这个片段解析;也可以直接用正则解吸;当然也可以直接作为普通串用常规方法解析.

热点排行