1、引入
<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.15/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/1.10.15/js/jquery.dataTables.js"></script>
使用cdn引入,下载http://www.datatables.club/,别忘引入jquery。
html代码:
<table id="table_id_example" class="display">
<input type="hidden" id="url" value="{
{ url('user') }}">//服务器端地址
<thead>
<tr>
<th><span>ID</span></th>
<th><span>用户名</span></th>
<th><span>账号</span></th>
<th><span>添加时间</span></th>
<th><span>操作</span></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
js代码:
<script>
$(document).ready(function () {
var url = $('#url').val();
$('#table_id_example').DataTable({
"serverSide": true,
"processing": true,
"bStateSave": true,
"searching":