PHP+Ajax+dataTables无刷新分页演示
JavaScript Code
- <script type="text/javascript">
- var datatables = $('#tables').dataTable({
- "bServerSide": true,
- 'bPaginate': true, //是否分页
- "bProcessing": true, //datatable获取数据时候是否显示正在处理提示信息。
- "iDisplayLength": 2, //每页显示10条记录
- 'bFilter': true, //是否使用内置的过滤功能
- "sAjaxSource": 'ajax.php',
- "aaSorting": [
- [0, "desc"],
- ],
- "aoColumns": [
- {"mData": "name", "bSortable": true, "bSearchable": true, "sWidth": "250px"},
- {"mData": "message", "bSortable": true, "bSearchable": true},
- {"sWidth": "220px", "mData": "updatetime", "bSortable": true, "mRender": function(data, type, full) {
- return "" + data + "";
- }
- }
- ],
- "oLanguage": {
- 'sSearch': '数据筛选:',
- "sLengthMenu": "每页显示 _MENU_ 项记录",
- "sZeroRecords": "没有符合项件的数据...",
- "sInfo": "当前数据为从第 _START_ 到第 _END_ 项数据;总共有 _TOTAL_ 项记录",
- "sInfoEmpty": "显示 0 至 0 共 0 项",
- "sInfoFiltered": "(_MAX_)"
- },
- });
- </script>
XML/HTML Code
- <div class="table-responsive">
- <table id="tables" class="table table-striped table-bordered table-hover">
- <thead>
- <tr>
- <th>用户</th>
- <th>内容</th>
- <th>时间</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- </div>
原文地址:http://www.freejs.net/article_fenye_553.html