由于本人是初学者,在此记录难点代码,方便日后查看
<title>Insert title here</title>
<script type='text/javascript' src='/test/dwr/engine.js'></script>
<script type='text/javascript' src='/test/dwr/interface/test.js'></script>
<script type='text/javascript' src='/test/dwr/util.js'></script>
<script type="text/javascript">
window.οnlοad=add();
function add(){
test.getAll(cb);
}
function cb(data){
var cellfunces=[
function(data){return data.id;},
function(data){return data.name;},
function(data){return data.age;}
];
//删除所有行数据,避免数据重复
dwr.util.removeAllRows("demo1");
//demo1是tbody中的id
//data是获取的集合
//cellfunces是读取数据所用方法
dwr.util.addRows("demo1",data,cellfunces);
}
</script>
</head>
<body>
<input type="button" value="ajax" οnclick="add();" />
<table border="1px" id="tes">
<thead>
<tr>
<td>ewfde</td>
<td>efew</td>
<td>fewfe</td>
</tr>
</thead>
<tbody id="demo1">
</tbody>
</table>
</body>