0
我刚刚开始使用数据表,我正在处理数据表文档中的这个示例,但我无法获取要显示的数据。 这是.html file
:如何在数据表中显示数据?
<html>
<head>
<title>data</title>
<script href="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<script href="https://code.jquery.com/jquery-1.12.4.js"></script>
</head>
<body>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Extn.</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</tfoot>
</table>
<script type="text/javascript">
$(document).ready(function() {
$('#example').DataTable({
"ajax": 'arrays.txt'
});
});
</script>
</body>
</html>
,这是arrays.txt
文件:
{
"data": [
[
"Tiger Nixon",
"System Architect",
"Edinburgh",
"5421",
"2011/04/25",
"$320,800"
]
]
}
的问题是,没有数据显示在数据表中。
尝试将它放在'PRE'而不是表中进行调试。 'arrays.txt'好像在关闭花括号之前丢失了一个结束方括号! – neuhaus
控制台上的任何错误? –
@EliasSoares我得到这个:'未捕获的ReferenceError:未定义jQuery' – annie