使用Mustache JS进行Ajax分页?

时间:2013-05-28 14:18:14

标签: javascript jquery mustache

使用Mustache模板时是否可以实现分页? 我目前正在使用模板输出JSON的结果:

JS功能:

$.getJSON('assets/data/results.json', function(data) {
  var template = $('#results-template').html();
  var info = Mustache.to_html(template, data);
  $('.result-list').html(info);

示例模板:

<script id="results-template" type="text/template">
    {{#results}}
                <tr>
                    <td>{{field1}}</td>
                    <td>{{field2}}</td>
                    <td>{{field3}</td>
                </tr>

    {{/results}}
</script>

我可以输出结果很好,但不知道从哪里开始。使用MustacheJS时的分页。

1 个答案:

答案 0 :(得分:0)

Mootools也有一个用于此目的的插件,可以使用JSON数据

http://mootools.net/forge/p/xpagination