手机
当前位置:查字典教程网 >编程开发 >AJAX相关 >js装载xml文件然后发向服务器的实现代码
js装载xml文件然后发向服务器的实现代码
摘要:前台:复制代码代码如下:js装载xml文件然后发向服务器js装载xml文件然后发向服务器Ajax复制代码代码如下:usingSystem;u...

前台:

复制代码 代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>

<title>js装载xml文件然后发向服务器</title>

<script type="text/javascript"><></script>

</head>

<body>

<input type="button" value="request" />

</body>

</html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>

<title>js装载xml文件然后发向服务器</title>

<script type="text/javascript"><></script>

</head>

<body>

<input type="button" value="request" />

</body>

</html>

Ajax

复制代码 代码如下:

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Xml;

public partial class testXml_Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

XmlDocument xmldoc = new XmlDocument();

xmldoc.Load(Request.InputStream);//接收到客户端传来的xml

xmldoc.Save(Server.MapPath("~"+"/hello.xml"));

Response.Write(xmldoc.InnerXml);//返回修改后的Xml文档

Response.End();

}

}

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Xml;

public partial class testXml_Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

XmlDocument xmldoc = new XmlDocument();

xmldoc.Load(Request.InputStream);//接收到客户端传来的xml

xmldoc.Save(Server.MapPath("~"+"/hello.xml"));

Response.Write(xmldoc.InnerXml);//返回修改后的Xml文档

Response.End();

}

}

Xml文档:

复制代码 代码如下:

<?xml version="1.0" encoding="utf-8" ?>

<root>

<person id="1">

<name>tree</name>

<gender>male</gender>

</person>

</root>

【js装载xml文件然后发向服务器的实现代码】相关文章:

Ajax请求过程中下载文件在FireFox(火狐)浏览器下的兼容问题

ajax文件上传成功 解决浏览器兼容问题

ajax 异步获取数据实现代码 (js创建ajax对象)

Ajax 返回字符串的过滤实现代码

基于AJAX的分页类实现代码

js基本ajax写法示例代码

Ajax Control Toolkit 34个服务器端控件第1/2页

Ajax获取数据然后显示在页面的实现方法

ajax jquery校验用户是否已经注册演示代码

编写轻量ajax组件第三篇实现

精品推荐
分类导航