简体   繁体   中英

Jquery-dataTables Error while drawing tables

The problem is with jquery datatables. I am getting the data from the url through ajax

calls. Since I am using codeigniter framework I am using datatables library to generate the

datatable objects using echo $this->datatables->generate() in this function advertisement-details-data

The output of the function is also right.

$(document).ready(function(){

$('#example').dataTable
          ({  
            'bProcessing'    : true,
            'bServerSide'    : true,
            'sAjaxSource'    : '<?php echo base_url();?>advertisement-details-data',
            'iDisplayStart'  : 0,
            'fnServerData': function(sSource, aoData, fnCallback)
            {
             console.log(aoData);
             $.ajax 
              ({
                'dataType': 'json',
                'type'    : 'POST',
                'url'    : sSource,
                'data'  : aoData,
                'success' : fnCallback,
                'cache'   : false
              });
            }
          });
});

and console.log was giving me an output which contains datatables outputs ... and in web

console also i cant find any js errors. Please help me to solve this issue

This is the output of the console.log in the datatables plugin http://pastebin.com/YS7NQAdp

This is the output of the advertisement-details-data http://pastebin.com/NiVvcp8A

Nothing seems wrong with your js code as you are getting proper response , but i would suggest get your json return from the server (using Firebug or whatever) and check in http://jsonlint.com to see what's wrong with it. for more you can check datatables server side error .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM