Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我在服务器上有一个JSON文件,我想在JQuery数据表中显示它,并进行搜索、排序和分页_Jquery_Json_Ajax_Html - Fatal编程技术网

我在服务器上有一个JSON文件,我想在JQuery数据表中显示它,并进行搜索、排序和分页

我在服务器上有一个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 <

JSON文件是动态的。有人能帮我解决这个问题吗

<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 );