2
I’m making a datatable with ajax return.
$.getJSON("sql.php?operacao=usuario_lista&excluidos=false", function (data) {
alert(data.users);
$('#tabusuarios').DataTable({
"aaData": data.users,
"aoColumns": [
{ "mDataProp": "ID" },
{ "mDataProp": "NOME" },
{ "mDataProp": "USUARIO" }
]
});
});
My JSON returns to:
{
"users": [
{
"ID": "89",
"NOME": "aaabbbb",
"USUARIO": "a.b",
"DTNASC": "2017-01-01",
"NUM": "112233"
},
{
"ID": "76",
"NOME": "Bruno Pereira",
"USUARIO": "brunopereira",
"DTNASC": "2011-01-01",
"NUM": "11"
}
]
}
But he gives the error:
Datatables Warning: table id=tabusuarios - Cannot reinitialise Datatable. For more information about this error, Please see http://datatables.net/tn/3
And don’t populate a table..
Have you tried creating your table based on the examples of datatables.net? There are other ways to read a json, see here (ajax custom_data_property).
– Florida
already tried yes Florida.... it just does not carry anything...
– Rafael Spessotto