使用Mustache JS的Ajax分页

Ajax pagination using Mustache JS?

本文关键字:Ajax 分页 JS Mustache 使用      更新时间:2023-09-26

是否可以在使用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时从哪里开始重新分页

Mootools有一个插件可以处理JSON数据

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