Unknown Parameter '0' for row 0 column 0
Unknown Parameter '0' for row 0 column 0
Solved in comments, was missing a } to close the Ajax object
I've looked a little into this error and all the past suggestions don't appear to to apply to my situation.
JSON
{
"draw": 1,
"recordsTotal": 1353,
"recordsFiltered": 1353,
"data": [
{
"songname": "mind game",
"user_chart_rate_rate": "1.00",
"calcscore": "11.79",
"wifescore": "0.948812",
"datetime": "2017-03-14 01:16:47",
"marv": "317",
"perfect": "67",
"great": "10",
"good": "6",
"bad": "1",
"miss": "1",
"maxcombo": "190"
},
{
"songname": "Ievan Polkka (Rin&Len ver.)",
"user_chart_rate_rate": "1.00",
"calcscore": "14.43",
"wifescore": "0.984589",
"datetime": "2017-04-05 20:24:49",
"marv": "508",
"perfect": "69",
"great": "4",
"good": "0",
"bad": "0",
"miss": "1",
"maxcombo": "522"
},
]
}
JavaScript
<script>
$(document).ready(function () {
$('#scoresTable').DataTable({
"processing": true,
"serverSide": true,
"ajax":{
"url": "<?php echo base_url('user/scores') ?>",
"dataType": "json",
"type": "POST",
"columns": [
{ "data": "songname"},
{ "data": "user_chart_rate_rate"},
{ "data": "calcscore"},
{ "data": "wifescore"},
{ "data": "datetime"},
{ "data": "marv"},
{ "data": "perfect"},
{ "data": "great"},
{ "data": "good"},
{ "data": "bad"},
{ "data": "miss"},
{ "data": "maxcombo"}
]
}
});
});
</script>
HTML
<table id="scoresTable" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>Songname</th>
<th>Rate</th>
<th>Score</th>
<th>Wife</th>
<th>Date</th>
<th>Marvelous</th>
<th>Perfect</th>
<th>Great</th>
<th>Good</th>
<th>Bad</th>
<th>Miss</th>
<th>Combo</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
I can't for the life of me see what is causing the error, others have said it is because there are more table headers than content, but that doesn't appear to be the case - the JSON seems well formed and matches the JavaScript declaration of columns.
Any help is greatly appreciated.
This question has an accepted answers - jump to answer
Answers
add an empty <tbody> and remove the one extra comma after the last column data.
I did both of your suggestions and still get the same error.
I solved it
The Columns are part of the Ajax object, I was missing a closing brace for the Ajax object, the correct code looks like