Php 数据表中第0行请求的未知参数“prog_name”错误
在我的一个PHP项目中,我有一个数据表。我需要在数据表的行单击上显示额外/详细信息。为此,我尝试实现在中给出的示例。但是,它不起作用。它向我显示了错误DataTables警告:table id=manage\u elvideos\u table-为第0行请求的未知参数“prog\u name”。有关此错误的详细信息,请参阅http://datatables.net/tn/4 正如错误消息中所建议的,我已尝试通过以下建议点来克服错误,但尚未成功 用于填充数据表的ajax调用工作正常,返回状态200,响应如下:Php 数据表中第0行请求的未知参数“prog_name”错误,php,jquery,datatable,Php,Jquery,Datatable,在我的一个PHP项目中,我有一个数据表。我需要在数据表的行单击上显示额外/详细信息。为此,我尝试实现在中给出的示例。但是,它不起作用。它向我显示了错误DataTables警告:table id=manage\u elvideos\u table-为第0行请求的未知参数“prog\u name”。有关此错误的详细信息,请参阅http://datatables.net/tn/4 正如错误消息中所建议的,我已尝试通过以下建议点来克服错误,但尚未成功 用于填充数据表的ajax调用工作正常,返回状态200
{"draw":1,"recordsTotal":1,"recordsFiltered":1,"data":[["B.Ed","Year 1","Course 1","Unit 1","Meaning, Nature and principal of Growth and development","Miss Babita","1","\n <a href=\"http:\/\/localhost\/jdnbcci\/hoopla\/elearning\/edit_elvideos\/1\" id=\"48_b\" data-value=\"uac_ea\" class=\"trix\" title=\"Edit\"> <span class=\"glyphicon glyphicon-edit\"><\/span><\/a>\n <a href=\"http:\/\/localhost\/jdnbcci\/hoopla\/elearning\/view_elvideos\/1\" id=\"48_c\" data-value=\"uac_va\" class=\"trix\" title=\"View\"> <span class=\"glyphicon glyphicon-eye-open\"><\/span><\/a>\n <a href=\"http:\/\/localhost\/jdnbcci\/hoopla\/elearning\/delete_elvideos\/1\" id=\"48_d\" data-value=\"uac_da\" class=\"trix\" title=\"Delete\"> <span class=\"glyphicon glyphicon-trash\"><\/span><\/a>\n "]]}
var dataTable = $('#manage_elvideos_table').DataTable({
//"processing":true,
"serverSide":true,
//"order":[],
"ajax":{
url:"<?=site_url();?>hoopla/elearning/fetch_elvideos",
dataType: 'json',
type:"POST"
},
"columns": [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ "data": "prog_name" },
{ "data": "prog_year" },
{ "data": "course_name" },
{ "data": "unit_name" },
{ "data": "ut_unit_sub_topic" },
{ "data": "as_apts_name" },
{
"data": "video_id",
"render":function(data, type, row, meta){
data = '<a href="<?=site_url();?>nautics/bankagent/view/' + data + '" class="btn btn-warning btn-xs" title="View"><i class="far fa-eye"></i></a> <a href="<?=site_url();?>nautics/bankagent/edit/' + data + '" class="btn btn-info btn-xs" title="Edit"><i class="far fa-edit"></i></a> <a href="javascript:feature_in_next_version();" class="btn btn-danger btn-xs" title="Delete"><i class="far fa-trash-alt"></i></a>';
return data;
}
}
],
"order": [[1, 'asc']],
select: true,
colReorder: true
});
// Add event listener for opening and closing details
$('#manage_elvideos_table tbody').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = table.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
}
else {
// Open this row
row.child( format(row.data()) ).show();
tr.addClass('shown');
}
} );
<table class="table table-striped table-bordered table-hover" id="manage_elvideos_table">
<thead>
<tr>
<th></th>
<th>Prog</th>
<th>Year</th>
<th>Course</th>
<th>Unit</th>
<th>Video On</th>
<th>Video By</th>
<th>Options</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th>Prog</th>
<th>Year</th>
<th>Course</th>
<th>Unit</th>
<th>Video On</th>
<th>Video By</th>
<th>Options</th>
</tr>
</tfoot>
</table>
请告知我的代码有什么问题。我将把它转换成代码片段。我们只需要做一个例子,就是site_url的值。然后我们可以从那里开始,看看我们到了哪里。感谢@Ivan86的评论,但不幸的是,这个项目不能在互联网上获得,只能在本地计算机上进行直播。