我在服务器上有一个JSON文件,我想在JQuery数据表中显示它,并进行搜索、排序和分页
JSON文件是动态的。有人能帮我解决这个问题吗我在服务器上有一个JSON文件,我想在JQuery数据表中显示它,并进行搜索、排序和分页,jquery,json,ajax,html,Jquery,Json,Ajax,Html,JSON文件是动态的。有人能帮我解决这个问题吗 <div class="col-lg-12"> <table id="example" class="display" cellspacing="0" width="100%"> <thead> <tr> <th>ID</th> <th>Amount <
<div class="col-lg-12">
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>ID</th>
<th>Amount </th>
<th>Status</th>
<th>Time</th>
<th>Owner</th>
<th>Weight</th>
<th>Quantity</th>
<th>Order Type</th>
<th>PID</th>
<th>Special Instructions</th>
</tr>
</thead>
</table>
</div>
</body>
身份证件
数量
地位
时间
所有者
重量
量
订单类型
PID
特别说明
这是一把小提琴,我可以看到您正在使用datatable来实现您的目标。我指的是 加载数据 只需使用Ajax选项设置Ajax请求的URL,即可通过DataTables加载Ajax数据。例如,下面显示了使用Ajax源数据的最小配置:
$('#myTable').DataTable( {
ajax: '/api/myData'
} );
如果您的表应该在此时刷新,您可以设置并调用
以下是一个例子:
var table = $('#example').DataTable( {
ajax: "data.json"
} );
setInterval( function () {
table.ajax.reload();
}, 30000 );