I have page with data table and i need to refresh only data in table and i use bootstrap datatable to sort but when i use refresh data in my page will can not use bootstrap to sort data. How can i fix it?
this my code for get data to refresh
$request = $this->m_request->get_request_list();
$row = '';
$row .= '<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="datatable">';
$row .= '<thead>';
$row .= '<tr>';
$row .= '<td>Start</td>';
$row .= '<td>End</td>';
$row .= '<td>Type</td>';
$row .= '</tr>';
$row .= '</thead>';
$row .= '<tbody>';
foreach ($re as $r){
$row .= '<tr id="sh">';
$row .= '<td>'.$r->date_start.'</td>';
$row .= '<td>'.$r->date_end.'</td>';
$row .= '<td>'.$r->leave_type.'</td>';
$row .= '</tr>';
}
$row .= '</tbody>';
$row .= '</table>';
echo $row;
and this is my javascript to get data to show
var $container = $("#show_data");
$container.load("<?php echo site_url('request/get')?>");
var refreshId = setInterval(function()
{
$container.load('<?php echo site_url('request/get')?>');
}, 3000);
if i show table in view page the data will can not refresh to get data and if i call table in controller page i will can not use bootstrap datatable. Please help. Thank you so much for your help.