我知道这是一个流行的问题,我已经在Stack Overflow和其他网站(包括DataTables网站)上阅读了所有类似的问题.
为了澄清,我正在使用
- PHP Codeigniter
- Materliazecss
I have also made sure that I received the JSON array correctly:
[{"name_en":"hello","phone":"55555555"},{"name_en":"hi","phone":"00000000"}]
My HTML table looks like this:
<table id="customer_table">
<thead>
<tr>
<th>Name</th>
<th>Phone</th>
</tr>
</thead>
</table>
下面是我的document.ready
个函数:
$(document).ready(function(){
//$('#customer_table').DataTable();
$('#customer_table').DataTable( {
"ajax": 'json',
"dataSrc": "",
"columns": [
{ "data": "email" },
{ "data": "name_en" }
]
});
});
The error I am getting is
未捕获的TypeError:无法读取未定义的属性"Length"