Js 中创建Xml文档,用Ajax传到Cs中处理(C#)
function ImportRun()
{
if(document.all.Content.children.length>0)
{
var oTable=document.all.Content.children(0);
var oFldInfo=new Array();
var oSendDom=CreateXmlDom("<dl/>");
if(oTable.tagName=="TABLE")
{
var oHeadRow=oTable.rows(0);
for(var k=0;k<oHeadRow.cells.length;k++)
{
oFldInfo.push(oHeadRow[k].innerText);
}
for(var i=1;i<oTable.rows.length;i++)
{
oHeadRow=oTable.rows(i);
for(var j=0;j<oHeadRow.cells.length;j++)
{
var oSI=oSendDom.createElement("di");
oSI.setAttribute(oFldInfo[j].toString(),oHeadRow[j].innerText);
alert(oHeadRow.cells(j).innerText+oTable.rows.length);
oSendDom.documentElement.appendChild(oSI);
}
}
}
}
else
{
alert("eeee");
}
// CreateXml2();
// var oSendDom=CreateXmlDom("<dl/&g
相关文档:
<script type="text/javascript">
<!--
//将用户输入异步提交到服务器
function ajaxSubmit(){
//获取用户输入
var question=document.forms[0].question.value;
//创建XMLHttpRequest对象
var xmlhttp;
try{
xmlhttp=new XMLHttpRequest();  ......
1. 首先下载 dwr.jar包,下载地址: http://directwebremoting.org/dwr/
2. 在应用中引入 dwr.jar包
3. 修改web.xml配置文件
<servlet>
<servlet-name>dwr</servlet-name>
......
大家好,最近使用jquery的ajax功能,但是发现$.ajax()方法不能提交到后台,我是用的是IE7,
其他方法如get和post没有试过,但由api所知底层都是用ajax方法来实现的。
通过查看源码发现
// Create the request object; Microsoft failed to properly
// implement the XMLHttpRequest in IE7, so we use the ActiveXObje ......
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace W ......