I'm trying to populate a table with a JSON file using DataTables, but every time I load up the page, the table just shows "No data available in table".
This is my current code:
<table id="table_id" class="display">
<thead>
<tr>
<th>ID</th>
<th>Nombre</th>
<th>Apellido</th>
<th>Mail</th>
<th>Confirmado</th>
</tr>
</thead>
<tbody>
<tr>
<td>Row 1 Data 1</td>
<td>Row 1 Data 2</td>
</tr>
<tr>
<td>Row 2 Data 1</td>
<td>Row 2 Data 2</td>
</tr>
</tbody>
</table>
<script>
$(document).ready(function () {
$('#table_id').DataTable({
"ajax" : {"url":"/personas.json", "dataSrc":""},
"columns" : [
{personas : "id"},
{personas : "nombre"},
{personas : "apellido"},
{personas : "email"},
{personas : "confirmado"}
]
});
});
</script>
This is a piece of the JSON code:
{
"personas": [
{
"id": 0,
"nombre": "Aurelia",
"apellido": "Osborn",
"email": "[email protected]",
"confirmado": false
},
{
"id": 1,
"nombre": "Curry",
"apellido": "Jefferson",
"email": "[email protected]",
"confirmado": true
}
]
}
And this is what I get when I load up the page (part of it):
And just in case it might be the problem, this is the directory of the JSON:

