前台:
var xml = "<root>";
if(Name!=null) { xml += "<name>"+Name +"</name>"; } else { alert("请输入站点名称"); return; } if(icp!=null) { xml +="<icp>"+icp+"</icp>"; } else { alert("请输入备案信息"); return; } xml +="</root>"; $.ajax({ type:"post", url:"updata.ashx?datetime="+new Date().getDate(), dataType:"text", data:"&data="+encodeURIComponent(encodeURIComponent(xml)), success:function(obj) { //do some things } })后台
string data = context.Request.Form["data"].ToString();
data = "<?xml version=\"1.0\" encoding=\"GB2312\" ?>" + data; XmlDocument doc = new XmlDocument(); doc.LoadXml(HttpUtility.UrlDecode(data));XmlNode Title = doc.SelectSingleNode("root/Title");
XmlNode Content = doc.SelectSingleNode("root/Content");