Monthly Archives: October 2016

Simple code

This is just a basic code to use datatables.

Important components in the code:

  1. include of js, css on top
  2. declaring ‘thead’ tag
  3. declaring ‘id’ of the table to be same as called in js at the bottom
  4. include js script at the bottom

or can refer here for code


<link rel="stylesheet" type="text/css" href="">
<script src=""></script>
<script src=""></script>
<h1>A List</h1>
<table id="myTable" class="display" cellspacing="0" border="1">
    $counter = 0;
    foreach ($branch_list as $row) {
        <td><?php echo $row->orgname; ?></td>
        <td><?php echo $row->sessionname; ?></td>
        <td><?php echo $row->total_student; ?></td>
    <?php } ?>
$(document).ready(function() {
} );