JSon don't work
JSon don't work
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.
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.
This discussion has been closed.
Replies
Allan