good morning,
I have an ajax where I send a variable id_account which I take it when reading the id of the option of a select, I then make a query which returns all the data of that account, I know that this part is fine because when I review the echo of the .php returns the following, that is, if I capture the id_account well
[{"0":"86","id":"86","1":"JAIRO MARTINEZ","nombre_cliente":"JAIRO MARTINEZ","2":"56565","egreso_lazo_oriente":"56565","3":"332","valor_recibido":"332","4":"1","p_favor_boletaf":"1","5":"1","p_favor_registro":"1","6":"3614","p_cancela_boletaf":"3614","7":"6","p_cancela_registro":"6","8":"5","p_cancela_biometria":"5","9":"6345","p_impuestos":"6345","10":"6","p_pazysalvo_valorizacion":"6","11":"16","p_pazysalvo_predial":"16","12":"64","p_pazysalvo_areametropolitana":"64","13":"0","p_deuda_acreedor_hipotecario":"0","14":"0","p_deuda_acreedor_personal":"0","15":"0","p_desembargo":"0","16":"0","p_remanente":"0","17":"0","p_honorarios":"0","18":"0","p_domicilios":"0","19":"0","p_levantamiento_aceptacion":"0","20":"0","p_compraventa":"0","21":"0","p_otros":"0","22":"11","e_favor_boletaf":"11","23":"1","e_favor_registro":"1","24":"65","e_cancela_boletaf":"65","25":"456","e_cancela_registro":"456","26":"634","e_cancela_biometria":"634","27":"612","e_impuestos":"612","28":"146","e_pazysalvo_valorizacion":"146","29":"46","e_pazysalvo_predial":"46","30":"0","e_pazysalvo_areametropolitana":"0","31":"0","e_deuda_acreedor_hipotecario":"0","32":"0","e_deuda_acreedor_personal":"0","33":"0","e_desembargo":"0","34":"0","e_remanente":"0","35":"0","e_honorarios":"0","36":"0","e_domicilios":"0","37":"0","e_levantamiento_aceptacion":"0","38":"0","e_compraventa":"0","39":"0","e_otros":"0","40":"NO","j_favor_boletaf":"NO","41":"NO","j_favor_registro":"NO","42":"NO","j_cancela_boletaf":"NO","43":"NO","j_cancela_registro":"NO","44":"NO","j_cancela_biometria":"NO","45":"NO","j_impuestos":"NO","46":"NO","j_pazysalvo_valorizacion":"NO","47":"NO","j_pazysalvo_predial":"NO","48":"NO","j_pazysalvo_areametropolitana":"NO","49":"NO","j_deuda_acreedor_hipotecario":"NO","50":"NO","j_deuda_acreedor_personal":"NO","51":"NO","j_desembargo":"NO","52":"NO","j_remanente":"NO","53":"NO","j_honorarios":"NO","54":"NO","j_domicilios":"NO","55":"NO","j_levantamiento_aceptacion":"NO","56":"NO","j_compraventa":"NO","57":"NO","j_otros":"NO"}]
the problem lies in reading the json in the ajax, which is giving me error
here the script -------------------------------------------- -
function actualizar_cuenta()
{
var selector = document.getElementById("select_cuenta_encontrada");
//capturo el id del option que contiene el id de la cuenta del cliente
var id_cuenta = selector.options[selector.selectedIndex].id;
$.ajax({
url: "../PHP/consultar_datos_de_cuenta.php",
type: "POST",
dataType:'json',
data:({id_cuenta: id_cuenta}),
}).done(function(respuesta)
{
var json = $.parseJSON(respuesta); //aqui creo esta el error
for (var i=0;i<json.length;++i)
{
alert(json[i].name); //alert para comprobar los campos
}
});
}