Ich versuche, JSON von HTTP zu verarbeiten, aber es funktioniert nicht.Jedes Tag in Vorlage funktioniert nicht, wenn ich HTTP verwende
Mein Endpunkt mir dieses JSON bringen:
[
{
"data":"1992-04-27 00:00:00",
"0":"1992-04-27 00:00:00",
"numeroProntuario":"PAR 08 1377 051",
"1":"PAR 08 1377 051",
"nome":"ABDO AZIZ NADER ",
"2":"ABDO AZIZ NADER ",
"nascimento":"1933-08-26 00:00:00",
"3":"1933-08-26 00:00:00",
"sexo":"M",
"4":"M",
"estado_civil":"CASADO",
"5":"CASADO",
"filhos":"0",
"6":"0",
"local_nascimento":"BEIRUT ",
"7":"BEIRUT ",
"rg":"",
"8":"",
"cpf":"",
"9":"",
"enviado_por":"",
"10":"",
"endereco_res":"RUA ANT\u00d4NIO ANDRADE REBELO, 912",
"11":"RUA ANT\u00d4NIO ANDRADE REBELO, 912",
"bairro_res":"MORUMBI ",
"12":"MORUMBI ",
"cidade_res":"S\u00c3O PAULO",
"13":"S\u00c3O PAULO",
"estado_res":"SP",
"14":"SP",
"cep_res":"05692000",
"15":"05692000",
"fone_res":"",
"16":"",
"celular":"",
"17":"",
"profissao":"INDUSTRIAL ",
"18":"INDUSTRIAL ",
"cargo":"DIRETOR ",
"19":"DIRETOR ",
"atividade":"",
"20":"",
"empresa":"INTEXTIL ALIL NADER ",
"21":"INTEXTIL ALIL NADER ",
"endereco_com":"RUA CONSELHEIRO COTEGIPE, 294",
"22":"RUA CONSELHEIRO COTEGIPE, 294",
"cidade_com":"S\u00c3O PAULO",
"23":"S\u00c3O PAULO",
"estado_com":"SP",
"24":"SP",
"cep_com":"03058000",
"25":"03058000",
"fone_com":"",
"26":"",
"motivo":"STRESS",
"27":"STRESS",
"email":"",
"28":"",
"numeroCartao":"",
"29":"",
"cod_convenio":"PAR",
"30":"PAR",
"codigo_convenio_plano":"116",
"31":"116",
"codigo_paciente":"2290",
"32":"2290"
}
]
Und mein Skript ist:
Template.listarCampanhas.helpers ({
paciente : function(){
try {
HTTP.get("http://localhost:90/medico/testeAccess.php",null,function(error, response) {
return response.data;
});
}
catch(e){
console.log("Cannot get paciente data...", e);
}
}
});
In meiner Vorlage habe ich:
<template name="listarCampanhas">
<h3>Campanhas</h3>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Nome</th>
<th>numero Prontuario</th>
</tr>
</thead>
<tbody>
{{#each paciente}}
<tr>
<td>{{nome}}</td>
<td>{{numeroProntuario}}</td>
</tr>
{{/each}}
</tbody>
</table>
<hr>
</template>
niemanden wissen, wie dieses Problem zu beheben ?
Versuchen Sie es mit 'JSON.parse' an diesem response.data oder wo auch immer Ihre Antwort ist. –