Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery数据表类型错误:j[k]未定义_Jquery_Json_Jquery Datatables - Fatal编程技术网

jquery数据表类型错误:j[k]未定义

jquery数据表类型错误:j[k]未定义,jquery,json,jquery-datatables,Jquery,Json,Jquery Datatables,我使用jQueryDataTable作为数据列表。 我的问题是当页面加载返回ig TypeError:j[k]是未定义的。 我的getStudentDataTable.json未加载 我的Jquery代码如下所示: $(document).ready(funDemo); function funDemo() { $('#listTable').dataTable({ "bProcessing"

我使用jQueryDataTable作为数据列表。 我的问题是当页面加载返回ig TypeError:j[k]是未定义的。 我的getStudentDataTable.json未加载

我的Jquery代码如下所示:

   $(document).ready(funDemo);
            function funDemo() {
                $('#listTable').dataTable({

                    "bProcessing": true,
                    "bServerSide": true,
                    "iDisplayLength": 10,
                    "sAjaxSource": "http://localhost/getStudentDataTable.json",
                    "aoColumns": [ 
                        {mData: "Student.id"},
                        {mData: "Student.stud_name"},
                        {mData: "Student.Roll_no"},


                    ],
                    "fnCreatedRow": function (nRow, aData, iDataIndex) {
                        $('td:eq(4)', nRow).html("<input onclick='return editContact(" + JSON.stringify(aData.Student) + ");' type='button' value='Edit'>");
                        $('td:eq(5)', nRow).html("<input onclick='return deleteContact(" + JSON.stringify(aData.Student) + ");' type='button' value='Delete'>");
                        //$('td:eq(4)', nRow).html('<a href="/contacts/view/'+aData.Contact.id+'">'+aData.Contact.email+'</a>');
                    }

                });
}
Html表格定义如下:

  <table id="listTable" border="1" cellpadding="5">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Stud name</th>
                        <th>roll no</th>
                        <th colspan='2'>Action</th>
                    </tr>
                </thead>
            </table>

身份证件
螺柱名称
卷号
行动

身份证件
螺柱名称
卷号
行动
我已删除colspan。


身份证件
螺柱名称
卷号
行动

我已经删除了colspan。

我也遇到了同样的问题,花了将近1个小时来修复它。解决方案非常简单。我只需在我的
HTML->TABLE
中添加一列
,问题就解决了。

我也遇到了同样的问题,花了将近1个小时来解决它。解决方案非常简单。我只需要在我的
HTML>表中添加一列
,问题就得到了解决。

如果你在
fnCreatedRow
中注释掉这两行会发生什么?没有fnCreatedRow,它工作正常。我已经解决了这个问题。我给出了colspan=2的动作,这就产生了问题。如果你注释掉
fnCreatedRow
中的2行,会发生什么?没有了fnCreatedRow,它工作正常。我已经解决了这个问题。m给出colspan=2的动作,所以这就是问题所在。你们能用一些代码详细说明一下吗?你到底在哪里加的td?在…内在一个新的世界里?这对我很有用。我不小心添加了错误的
s行。您能用一些代码详细说明一下吗?你到底在哪里加的td?在…内在一个新的世界里?这对我很有用。我不小心添加了错误的
s行。
  <table id="listTable" border="1" cellpadding="5">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Stud name</th>
                        <th>roll no</th>
                        <th colspan='2'>Action</th>
                    </tr>
                </thead>
            </table>
<table id="listTable" border="1" cellpadding="5">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Stud name</th>
                        <th>roll no</th>
                        <th>Action</th>
                    </tr>
                </thead>
            </table>