java 在javascript里面获取到一个List怎么把里面的内容显示在页面里面!求大神帮忙给出代码!

2024-11-08 08:55:36
推荐回答(2个)
回答(1):

这是JS代码

function init(a){
$("#show_list tr").remove();
var code = $.trim($("#code").val());
var currentPage = parseInt($.trim($("#currentPage").val()) == null || "" == $.trim($("#currentPage").val()) ? 1 : $.trim($("#currentPage").val()));
var totalPage = parseInt($.trim($("#totalPage").val()) == null || "" == $.trim($("#totalPage").val()) ? 1 : $.trim($("#totalPage").val()));
if(a == 1){
currentPage = currentPage + 1;
} else {
currentPage = currentPage - 1;
}

if(currentPage < 1){
currentPage = 1;
} else if(currentPage > totalPage){
currentPage = totalPage;
}
$("#currentPage").val(currentPage);
$.ajax({
url : "sy/showStockComment.html",
dataType : "JSON",
type : "post",
data : {
"code" : code,
"currentPage" : currentPage
},
success : function(data){
var $dataTable = $("#show_list");
$(data).each(function(){
$dataTable.append("

"+this.COMMENT_CONTENT+"
"+this.USER_NAME+""+(this.CREATE_TIME.year+1900)+"-"+(this.CREATE_TIME.month+1)+"-"+this.CREATE_TIME.date+"赞("+this.SUPPORT_NUMBER+") 评论("+this.COMMENT_NUMBER+") 转发
");
});
},
});
}

这是HTML代码

回答(2):