2

The JSON file is dynamic. Can anyone help me out with this?

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

Here is a fiddle http://jsfiddle.net/Manoj1991/annxmks9/

Shridhar Patil
  • 362
  • 1
  • 17
Manoj Kadolkar
  • 717
  • 8
  • 22

1 Answers1

0

As I can see you're using datatable to achieve your goal. I refer to the official documentation

Loading data

Ajax data is loaded by DataTables simply by using the ajax option to set the URL for where the Ajax request should be made. For example, the following shows a minimal configuration with Ajax sourced data:

$('#myTable').DataTable( {
  ajax: '/api/myData'
} );

If your table should be refreshed at time you can set a timeout function and call the Datatable ajax.reload() function.

Here is an example:

var table = $('#example').DataTable( {
    ajax: "data.json"
} );

setInterval( function () {
    table.ajax.reload();
}, 30000 );
Community
  • 1
  • 1
IlGala
  • 3,331
  • 4
  • 35
  • 49