如下代码
$.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);
}
});