如下代码
$.ajax({
type: "GET",
url: "newhome.action?method=accomplish", //请求action文件中的一个方法
dataType: "json",
success: function(data){
console.log(data);
var html = '';
$.each(data, function (commentIndex, comment){ //遍历返回的数据,使其动态加载到dom中。
html+='<tr><td><a href='+'/wiapi/showTaskForm?action=showTaskFrom&instanceid='+comment['pathe2']+'&taskid='+comment['pathb2']+'&openmode=refresh>'+comment['topic']+'</a></td><td>'+getMyDate(comment['time'])+'</td><td>'+comment['name']+'</td><td><a
href='+'/wiapi/processmonitor?resid='+comment['pathe2']+'&instanceid='+comment['path']+'>'+comment['play']+'</a></td></tr>';
})
$('#accomplish>tbody').html(html);
}
});
本文介绍了一种使用Ajax技术动态加载表格数据的方法。通过发送GET请求至指定的action文件并获取JSON格式的数据,利用jQuery处理这些数据并在网页上动态展示。具体实现包括遍历返回的JSON对象并构造HTML字符串,最后更新DOM元素。
1985

被折叠的 条评论
为什么被折叠?



