【发布时间】:2016-01-19 18:03:06
【问题描述】:
我对 ajax 和引导表有疑问。 我有一个用这种方法调用的 ajax JSON:
$(document).ready(function(){
$.ajax({
url: 'php/process.php?method=fetchdata',
dataType: 'json',
success: function(data) {
$('#clienti').bootstrapTable({
data: data
});
},
error: function(e) {
console.log(e.responseText);
}
});
});
我的 JSON 看起来正确,但表格没有显示任何记录。我做错了什么?
这里也是表定义
<table data-toggle="table" class="display table table-bordered" id="clienti">
<thead>
<tr>
<th>Nome</th>
<th>Cognome</th>
<th>Data Nascita</th>
<th>Provincia</th>
<th>Comune</th>
<th>CAP</th>
<th>Indirizzo</th>
<th>Fisso</th>
<th>Cellulare</th>
<th>Note</th>
</tr>
</thead>
</table>
这也是返回的json的一部分
[{"Nome":"","Cognome":"","DataN":"0000-00-00","Provincia":"","Comune":"","CAP":"","Indirizzo":"","Fisso":"","Mobile":"","Note":""},{"Nome":"Federico","Cognome":"Lupieri","DataN":"2015-09-16","Provincia":"","Comune":"","CAP":"34170","Indirizzo":"Via Ascoli 1","Fisso":"00112233445566","Mobile":"00112233445566","Note":"Vediamo se funziona questo"},
【问题讨论】:
-
bootstrapTable() 是做什么的?可以提供代码吗?
-
这里似乎是一个构造函数wenzhixin.net.cn/p/bootstrap-table/docs/getting-started.html 抱歉,我不能更具体,但这个类对我来说很新 =/
-
您的控制台中没有错误? (jQuery 等)
-
什么都没有。我也使用 firebug,在控制台中我只能看到调用的 json,但仅此而已
-
你能从成功函数中发布
data的样本吗?
标签: javascript jquery json ajax twitter-bootstrap