i used library datatable and codeigniter
i have a variable in view
$afd = "1"
and in this view i have a javascript
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#datatables').dataTable( {
"bJQueryUI":true,
"bProcessing": true,
"bServerSide": true,
"sPaginationType":"full_numbers",
"sAjaxSource": "<?=base_url()?>index.php/report/report/ajax_view_panen/",
"aaSorting": [[ 0, "asc" ]]
});
}); </script>
to call datatables in controller codeigniter . the function controller is "ajax_view_panen"
this is my controller
function ajax_view_panen()
{
$this->load->library('Datatables');
$this->datatables->from('panen');
$this->datatables->select('id,jml_panen,hariff_blok_id,hariff_afdeling_id,tgl_panen,bulan');
$this->datatables->where('id', $afd);
echo $this->datatables->generate();
}
the question is how to send variable $afd to my controller. so the variable is inside query $this->datatables->where('id', $afd); so the datatables show id = 1
sory for my bad english.
BR
Alex