Dynamically Insert Rows Into DataTable With Sorting

http://stackoverflow.com/a/25951157/1144203

HTML

<link rel="stylesheet" href="http://cdn.datatables.net/1.10.2/css/jquery.dataTables.css">
<script src="http://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
<table id="example" class="display" cellspacing="0" width="100%">
    <thead>
       <tr>
       <th>Service Type</th>
       <th>Service frequency</th>       
       </tr>
    </thead>
    <tbody id="tabledata">      
    </tbody>
</table>

JavaScript

var dataTable = $('#example').DataTable();