实例代码:
<table id="contentTable" class="table table-striped table-bordered table-condensed">
<thead><tr><th>序号</th><th>优化时间</th><th>优化前总能耗</th><th>优化后总能耗</th><th>优化后效果评估</th><th>附件</th></thead>
<tbody id="tableList"></tbody>
</table>
<script type="text/template" id="tableListTpl">
{{#list}}
<tr>
<td>{{id}}</td>
<td>{{yhTime}}</td>
<td>{{yhqEnergy}}</td>
<td>{{yhhEnergy}}</td>
<td>{{yhqResult}}</td>
<td>{{appendix}}</td>
</tr>
{{/list}}
</script>
var param = $("#searchForm").serialize();
// 异步请求
$.get(ctxStatic + "/modules/easysite/xypjGrid.json", param, function(result){
// 数据
var tpl = $("#tableListTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, "");
$("#tableList").html(Mustache.render(tpl, result));
// 分页
$(".pagination").html(result.page);
});