0
我有以下從服務器的JSON響應:數據表:如何在數據錶行中顯示json數據?
{
"rData": {
"total": 17,
"per_page": 3,
"current_page": 1,
"last_page": 6,
"next_page_url": "http://localhost:9901/securityquestionlist/?page=2",
"prev_page_url": null,
"from": 1,
"to": 3,
"data": [
{
"question": "Accessor: 15th question",
"full_name": "Dave Alex"
},
{
"question": "Accessor: 14th question",
"full_name": "Dave Alex"
},
{
"question": "Accessor: 13th question",
"full_name": "Dave Alex"
}
]
}
}
我有以下的HTML代碼:
<table id="IdSQLTable" class="table table-striped table-bordered table-hover">
<thead>
<tr><th>Question</th></tr>
</thead>
<tbody></tbody>
</table>
以下是JavaScript代碼:
jQuery(document).ready(function() {
jQuery('#IdSQLTable').DataTable({
'ajax' : {
'url': 'http://localhost:9901/securityquestionlist',
'data' : function(d){
d.myKey = 'MyValue';
},
'cache' : false,
'method' : 'POST'
},
"columnDefs": [ {
"targets": [ 0 ],
"data": 'rData.data.question',
"defaultContent": "Click to edit"
} ]
});
});
我無法打印 '問題'在桌子裏。有人能指導我如何去做。