I'm implementing a DataTable that makes an AJAX call. Per the Chrome browser F12 console, it's receiving the correct JSON response but not rendering the rows. What do I have wrong?
Index.html:
<script type="text/javascript">
$(document).ready(function () {
var transactionSearchResultsTable = $('#transactionSearchResults').DataTable({
"serverSide": true,
"ajax": {
"url": "@ajaxUrl",
"type": "POST",
"dataSrc": "dataArray",
},
"columns": [
{ "data": "rowSelection", "name": "", "autoWidth": true },
{ "data": "docId", "name": "Doc ID", "autoWidth": true }
]
});
});
</script>
<table id="transactionSearchResults" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>Row Selection</th>
<th hidden="hidden">Row Selection No.</th>
<th>Doc ID</th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td hidden="hidden"></td>
<td></td>
</tr>
</tbody>
</table>
JSON response:
{"draw":0,
"recordsTotal":75,
"recordsFiltered":10,
"dataArray":[{"rowSelection":1,"docId":"AC1B495B179D910E2F4000005E7D9060-1"},
{"rowSelection":2,"docId":"AC1B495B179D910E48D000005E7D9079-1"},
{"rowSelection":3,"docId":"AC1B495B179D8C533EA000005E7D9013-1"},
{"rowSelection":4,"docId":"AC1B495B179D8C51A6F000005E7D8FDE-1"},
{"rowSelection":5,"docId":"AC1B495B179D8C2ABA5000005E7D8FA9-1"},
{"rowSelection":6,"docId":"AC1B495B179D2994B28000004982AB80-1"},
{"rowSelection":7,"docId":"AC1B495B179D29929FA000004982A830-1"},
{"rowSelection":8,"docId":"AC1B495B179CF49870C000004982A4E0-1"},
{"rowSelection":9,"docId":"1b3625b67ed23b3d:1d4b1ae8:178ac04bf12:-7ff7"},
{"rowSelection":10,"docId":"1b3625b67ed23b3d:1d4b1ae8:178ac04bf12:-7ff8"}
]
}