I have problems trying to parse my JS
Here I try to parse him
var JSONdata = JSON.parse(message); //parseo la informacion
// console.log(JSONdata);
nombre = JSONdata[0].nombre;
nit = JSONdata[0].nit;
funcionario = JSONdata[0].funcionario;
nro_radicado = JSONdata[0].nro_radicado;
nrosolicitud = JSONdata[0].nrosolicitud;
consulta = JSONdata[0].consulta;
hora = JSONdata[0].hora;
My file that uses ajax to connect ... with the function send(data)
sent the info to the my file js
$.ajax({
type: "POST",
url: "quotes_controller.php",
data: "fecha_cita="+fecha_cita+"&atendio="+atendio+"&nombre="+nombre+"&apellido="+apellido+"&LISTA="+LISTA+"&nroradicado="+nroradicado+"&nrosolicitud="+nrosolicitud,
dataType:"html",
success: function(data)
{///// here sen data response
send(data);// array JSON
/////////////////////////////////////
window.location.href = 'index.php'
},
error: function( jqXHR, textStatus, errorThrown ){
alert('algo fallo...');
console.log(jqXHR);
}
});
My php does the Json after inserting in the DB
$arrayjson = array();
$arrayjson[] = array(
'nit' => '1223344',//nit del solicitante
'nombre' => 'el nombre',// nombres concatenados
'funcionario' => $_POST['atendio'],//quien atiende
'nro_radicado' => $nro_radicado,//numero de radicado
'nrosolicitud' => $_POST['nrosolicitud'],// numero de solicitud
'consulta' => 'APORTAR PLANOS',//tipo de consulta que se realiza
'hora' => $hora//hora de agendamiento
);
echo json_encode($arrayjson);
The concole.log(message);
of the information that arrives before parsearla Is ...
[{"nit":"1223344","nombre":"el nombre","funcionario":"10","nro_radicado":"","nrosolicitud":"","consulta":"APORTAR PLANOS","hora":"11:04:47"}]
All the data have values ... I do not know what happens ... in advance thanks ...