JSon don't work

JSon don't work

josimarsbjosimarsb Posts: 12Questions: 0Answers: 0
edited September 2013 in General
Please help I have the simple estructure.

HTML
[code]

1
2
3
4
5
6
7




[/code]

JS:

[code]
$('#example').dataTable({
"oLanguage": {
"sLengthMenu": "Mostrar _MENU_ Itens por página",
"sZeroRecords": "Nenhum resultado econtrado",
"sInfo": "Itens _START_ até _END_ de _TOTAL_ registros",
"sInfoEmpty": "Tabela vazia",
"sInfoFiltered": "(encontrado(s) de _MAX_ registros)",
"sLoadingRecords": "Aguarde...",
"sSearch": "Procurar:",
"oPaginate": { "sFirst": "Início", "sPrevious": "Anterior", "sNext": "Próximo", "sLast": "Último" }
},
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "./ajax/table_requisicao.php",
"sPaginationType": "full_numbers",
"sScrollY": 200,
"bLengthChange": false,
"bAutoWidth": true,
"bScrollCollapse": false,
"bInfo": false,
"bFilter": true,
"asStripeClasses": [ 'linha_impar', 'linha_par' ],
"aoColumns": [ { "sTitle": "Requisição", "name":"numreq", "sWidth": "10%", "sClass" : "center", "mData": "numreq" },
{ "sTitle": "Nº Frota", "name":"numfrota","sWidth": "10%", "sClass" : "center", "mData": "numfrota" },
{ "sTitle": "Apelido", "name":"filial", "sWidth": "10%", "sClass" : "center", "mData": "filial" },
{ "sTitle": "Produto", "name":"status", "sWidth": "40%", "sClass" : "center", "mData": "status" },
{ "sTitle": "Solicitado", "name":"qtdesolic", "sWidth": "10%", "sClass" : "center", "mData": "qtdesolic" },
{ "sTitle": "Atendido", "name":"qtdeatend", "sWidth": "10%", "sClass" : "center", "mData": "qtdeatend" },
{ "sTitle": "Data Solicitação", "name":"dtsolic", "sWidth": "10%", "sClass" : "center", "mData": "dtsolic"}
]
});
[/code]

JSON returned by PHP Page:

[code]
{"sEcho":1,"iTotalRecords":7,"iTotalDisplayRecords":7,"aaData":[["58","CC178","31989","VVV","0","0","0"]]}
[/code]
I just validate my JSon Code and it is ok.

the message that I receive is:

DataTables warning (table id = 'example'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Please link to a test case or run the debugger over your table as noted in the forum rules. That error means exactly what is says - jQuery is telling us there is an error (its coming from jQuery not DataTables).

    Allan
This discussion has been closed.