I have the JSON invalid response problem but the answer is correct.
My problem is that I want to bring data to a JQuery DataTable, by means of an AJAX query sending 3 parameters. the part that fails is when it brings the answer in JSON format, it tells me that it is invalid, but it is well formatted. someone to guide me?
CONSULTATION
$Q= 'CALL 'sel_pd_cte'('.$id.', "'.$_POST['ini'].'", "'.$_POST['fin'].'")';
$QE=$enlace->Query($Q);
$i=0;
while ($row=mysqli_fetch_row($QE)) {
$Tpd["Data"][$i][]= array_map("utf8_encode", $row);
$i=$i + 1;
}
echo json_encode($Tpd);
?>
ANSWER:
{"Data":[[["1","Razon 2","2017-05-10","8000.00","Aprobado","Entregado"]],[["2","Razon 2","2017-05-15","5000.00","Aprobado","Entrega Parcial"]]]}
Bring the result from PHP:
Pedidos(){
$('#T_Pd').DataTable({
"destroy":true,
"ajax":{
"method": "POST",
"url": "tped.php"
},
"columns":[
{"Data":"0"},
{"Data":"1"},
{"Data":"2"},
{"Data":"3"},
{"Data":"4"},
{"Data":"5"}
]
})
};