gpt4 book ai didi

javascript - 类型错误 D 未定义 Jquery 数据表

转载 作者:行者123 更新时间:2023-11-28 00:02:48 25 4
gpt4 key购买 nike

我有以下代码,应该使用数据表生成报告。但它一直失败,给出以下 jquery datatbles 错误:

TypeError: d is undefined


...=f.nextSibling}else{d=b.anCells;f=0;for(b=d.length;f<b;f++)a(d[f])}return{data:e...

下面是我应该生成 View 的代码,目前我只得到一个空白

<!DOCTYPE html>
<html lang="en">
<head>
<!--

-->
<meta charset="utf-8">
<title>Care-tech System</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Out patient Hospital Management System.">
<meta name="author" content="Harris Samuel Dindi">
</head>
<body>
<table id="test_trial" class="test_trial">
<thead>
<tr></tr>
</thead>
<tbody>
<tr></tr>
</tbody>
</table>
</body>
</html>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="http://cdn.datatables.net/1.10.5/js/jquery.dataTables.min.js"></script>

<link href='http://cdn.datatables.net/1.10.5/css/jquery.dataTables.css' rel='stylesheet'>



<script type="text/javascript">
$(document).ready(function () {

$("#test_trial").DataTable({
stateSave: true,
"bautoWidth": false,
"aoColumns": [
{"sTitle": "Commodity No", "mData": "commodity_id"},
{"sTitle": "Commodity Name.", "mData": "commodity_name"

},
{"sTitle": "Strength", "mData": "strength"},
{"sTitle": "Commodity code", "mData": "commodity_code"},
{"sTitle": "Type.", "mData": "commodity_type"},
{"sTitle": "Commodity unit", "mData": "commodity_unit"},
{"sTitle": "Max Stock", "mData": "max_stock"},
{"sTitle": "Min sTOCK", "mData": "min_stock"},
{"sTitle": "Remarks", "mData": "remarks"},
],
"bDeferRender": true,
"bProcessing": true,
"bDestroy": true,
"bLengthChange": true,
"iDisplayLength": 20,
"sAjaxDataProp": "",
"sAjaxSource": '<?php echo base_url() . "pharmacy/commodity_managements"; ?>',
"aaSorting": [[2, "desc"]]

});

});
</script>

如何消除该错误?

最佳答案

TypeError: d is undefined 意味着您的服务器端 php 端点 URL (pharmacy/commodity_managements) 没有向网格返回任何数据。尝试调试您的 php 响应。

关于javascript - 类型错误 D 未定义 Jquery 数据表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31638982/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com