bootStrap table+ajax加载数据

来源:互联网 发布:软件授权使用协议书 编辑:程序博客网 时间:2024/05/16 17:10
//ajax加载notice$(function() {//${pageContext.request.contextPath}/url = "getHomeNotice.action";$.ajax({url : url,type : "post",dateType : "text",success : function(res) {loadNotice(res); //加载notice}});});//加载noticefunction loadNotice(res) {var tBody = $("#noticeTable").find("tbody");for ( var index in res) {//新建一行var newTr = $("<tr></tr>");//新建节点var newsTd = $("<td></td>");var dateTd = $("<td></td>");//新建超链接var newsA = $("<a></a>");//添加内容和时间var noticeTitle = res[index].noticeTitle;var noticeDate = res[index].noticeDate;/* alert(noticeTitle);alert(noticeDate); */newsA.text(noticeTitle);dateTd.text(noticeDate);//添加数据td-tr-tbodynewsTd.append(newsA);newTr.append(newsTd);newTr.append(dateTd);tBody.append(newTr);}}<pre name="code" class="html">
<pre name="code" class="html">html<table id="noticeTable" class="table table-striped table-hover"><tr><th class="col-md-3">活动标题</th><th class="col-md-1">发布时间</th></tr></table>


                                             
0 1