Javascript 来自ajax排序的动态表不工作
我正在尝试加载json,数据看起来不错,但无法排序,问题是什么 以下是我的JavaScript:Javascript 来自ajax排序的动态表不工作,javascript,ajax,json,dynatable,Javascript,Ajax,Json,Dynatable,我正在尝试加载json,数据看起来不错,但无法排序,问题是什么 以下是我的JavaScript: $(document).ready(function() { var dynatable = $('table').dynatable({ dataset: { ajax: true, ajaxOnLoad: true, ajaxUrl: 'people
$(document).ready(function() {
var dynatable = $('table').dynatable({
dataset: {
ajax: true,
ajaxOnLoad: true,
ajaxUrl: 'people.json',
records: [],
perPageDefault: 4,
perPageOptions: [4,6,8,10]
},
params: {
records: 'People'
}
}).data("dynatable");
});
下表:
<table>
<thead>
<tr>
<th>NAME</th>
<th>ADDRESS</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
名称
地址
将表格html标记更改为
<table id="myTable">
$(document).ready(function() {
$('#myTable').dynatable({
dataset: {
ajax: true,
ajaxOnLoad: true,
ajaxUrl: 'people.json',
records: [],
perPageDefault: 4,
perPageOptions: [4,6,8,10]
},
params: {
records: 'People'
}
});
});