【问题标题】:Invalid Json response in codeigniter phpcodeigniter php中的无效Json响应
【发布时间】:2015-11-14 05:30:14
【问题描述】:

我想在我的网站中插入一个数据表。我在这里为 php 使用 Codeigniter。 正如datatables manual 中提到的,我按照指示做了,返回的 json 对象没有任何问题(使用开发人员工具抓取 json 对象)。我也用 JsonLint 验证了它,它是有效的。但我仍然收到错误消息“无效的 Json 响应”。

无效的 Json 响应

这是我认为的 javascript。

$(document).ready(function(){
    $('#table1').dataTable({
        "sAjaxSource": "http://localhost/project/index.php/conM/loadMarks"
    });
});

并且表的 id 是 'table1'。有人可以给我一些建议吗?

【问题讨论】:

    标签: javascript jquery json codeigniter


    【解决方案1】:

    你的 Json 源应该像下面的例子

    {"draw":0,"recordsTotal":4,"recordsFiltered":4,"data":[["2","3q","qww","Active"],["3","wert","erthj","Active"],["5","testdata","test description","Active"],["6","wertyh","asdfgh","Active"]]}
    

    您能否复制粘贴 ajax 源以获得更好的帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-25
      • 1970-01-01
      • 2015-12-27
      • 2015-10-28
      • 1970-01-01
      相关资源
      最近更新 更多