简体   繁体   English

绘制表时出现Jquery-dataTables错误

[英]Jquery-dataTables Error while drawing tables

The problem is with jquery datatables. 问题出在jQuery数据表上。 I am getting the data from the url through ajax 我正在通过Ajax从URL获取数据

calls. 电话。 Since I am using codeigniter framework I am using datatables library to generate the 由于我使用的是codeigniter框架,因此我使用的是datatables库来生成

datatable objects using echo $this->datatables->generate() in this function advertisement-details-data 在此函数中使用echo $ this-> datatables-> generate()的datatable对象advertise-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.log给我一个包含datatables输出的输出...并在网络中

console also i cant find any js errors. 控制台,我也找不到任何js错误。 Please help me to solve this issue 请帮我解决这个问题

This is the output of the console.log in the datatables plugin http://pastebin.com/YS7NQAdp 这是datatables插件http://pastebin.com/YS7NQAdp中 console.log的输出

This is the output of the advertisement-details-data http://pastebin.com/NiVvcp8A 这是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. 当您获得正确的响应时,您的js代码似乎没有问题,但是我建议您从服务器(使用Firebug或其他工具)获取json返回值,并检查http://jsonlint.com来查看问题所在。 for more you can check datatables server side error . 有关更多信息,请检查datatables服务器端错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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