This is my first time to use a jSon script and I am not familiar how to fix this, I think my problem is somewhere near the line where I put the <---"POSSIBLE ERROR SOMEWHERE HERE" because the alert is not displaying when it is inside that line.
<script>
$(document).ready( function () {
$('#acctable').dataTable({
"sPaginationType": "full_numbers",
"bAutoWidth": false,
"bFilter": false,
"bProcessing": true,
"bLengthChange": false,
"bServerSide": true,
"sAjaxSource": "<?php echo site_url() ?>/welcome/get_gen048",
"sServerMethod": "GET",
"fnServerData": function (sSource, aoData, fnCallback ) {
aoData.push( { "name": "sfdate" , "value": "<?php echo $_POST["sfdate"] ?>" } );
$.getJSON( sSource, aoData, function (json) {
alert("a")<----------"POSSIBLE ERROR SOMEWHERE HERE"
fnCallback(json);
} );
},
"aoColumns": [
{ "mdata" : "leftAligned" , "bSortable" : true, "bAutoWidth": false },
{ "sClass": "rightAligned", "bSortable" : true, "bAutoWidth": false },
{ "sClass": "rightAligned", "bSortable" : true, "bAutoWidth": false },
{ "sClass": "rightAligned", "bSortable" : true, "bAutoWidth": false },
{ "sClass": "rightAligned", "bSortable" : true, "bAutoWidth": false },
{ "sClass": "rightAligned", "bSortable" : true, "bAutoWidth": false },
{ "sClass": "rightAligned", "bSortable" : true, "bAutoWidth": false }
]
});
}
);
</script>
This part is not working whenever I place the alert inside this codes it doesn't appear anymore.
$.getJSON( sSource, aoData, function (json) {
fnCallback(json);
} );
Here is the result that is not appearing in the table.
Array
(
[sEcho] => 1
[iTotalRecords] => 6
[iTotalDisplayRecords] => 6
[aaData] => Array
(
[0] => Array
(
[0] => 000590071555
[1] => JOSEPHINE PADILLA NICOLAS OR LEONCIO SALUNDAY NICOLAS
[2] => 20 G CRUZ ST. ESTEBAN SOUTH DALANDAN
[3] => 07-18-2015
[4] => 0MPJBHANDIG
[5] => VALENZUELA CITY
[6] => 1059
)
[1] => Array
(
[0] => 000870026392
[1] => ISLAS COMMODITY TRADER INC
[2] => 6F DON JACINTO BLDG 141 SALCEDO ST LEGASPI
[3] => 07-18-2015
[4] => 0HMDAVID
[5] => MAKATI
[6] => 2087
)
Controller
function search_gen048() {
//echo 'ehllo';
$data['sfdate']=$this->input->post('sfdate');
//echo '-'. $data['sfDate'] . '-';
$data['main_content'] = 'sgen048';
$this->load->view('includes/template',$data);
}
function get_gen048(){
$this->load->model('navi_model');
$query = $this->navi_model->srch_gen048($_GET);
//echo $query;
}