想在html页面拼个表格,可惜var的变量没显示完,,是不是存满了数据?求大神看看,有图.在线等!!~~
这是反回的xml文档,
<NewDataSet><Table1><OP_ID>1</OP_ID><OP_NAME>dasfa</OP_NAME><OP_TIME>2013-04-15T11:30:51+08:00</OP_TIME><OP_LOCATION>adfa</OP_LOCATION><OP_COMPETENT>adfa</OP_COMPETENT><OP_PHONE>asdfa</OP_PHONE><OP_OFFICEPHONE>asdfa</OP_OFFICEPHONE><OP_U_ID>1</OP_U_ID></Table1><Table1><OP_ID>2</OP_ID><OP_NAME>safa</OP_NAME><OP_TIME>2013-04-15T15:10:36+08:00</OP_TIME><OP_LOCATION>sadfa</OP_LOCATION><OP_COMPETENT>adsfa</OP_COMPETENT><OP_PHONE>asdfa</OP_PHONE><OP_OFFICEPHONE>sadf</OP_OFFICEPHONE><OP_U_ID>14</OP_U_ID></Table1>
有很多这种table1
这是jquery代码..添加到tr这个变量中.
function onexm() {
alert("123");
$.post("../../../../AddXiangmu.asmx/Selectonexm", function (xml) {
var i = 0;
var tr="";
$(xml).find("Table1").each(function () {
i++;
tr += "<tr><td>" + i + "</td>";
tr += "<td>" + $(this).find("OP_ID").text() + "</td>";
tr += "<td>" + $(this).find("OP_NAME").text() + "</td>";
tr += "<td>" + $(this).find("OP_TIME").text() + "</td>";
tr += "<td>" + $(this).find("OP_LOCATION").text() + "</td>";
tr += "<td>" + $(this).find("OP_COMPETENT").text() + "</td>";
tr += "<td>" + $(this).find("OP_PHONE").text() + "</td>";
;
tr += "<td>" + $(this).find("OP_OFFICEPHONE").text() + "</td>"
tr += "<td><a href=''>删除</a></td>";
tr += "<td><a href=''>进入二级项目</a></td></tr>";
})
$("xmgl").find("table").html(tr);
alert(tr);
<