My difficulty is after sending to the java script how to separate each record:
Example: In my code I'm running this function:
$culturas=array();
$resultado=mysqli_query($conexao,"select *from mandioca_iea where id_cult=1");
while($cultura=mysqli_fetch_assoc($resultado))
{
array_push($culturas,$cultura);
}
echo json_encode($culturas);
And to receive the query:
$.post('envia.php', {nome: nome}, function(resposta) {}
So far so good, it sends something like this to Javascript:
On my console returned this: [{"iea_id":"1","man_ins_area_00":"0","man_ins_prod_00":"0","man_ins_area_05":"0", "man_ins_prod_05":"0","man_ins_area_10":"0","man_ins_prod_10":"0","man_ins_area_13":"0", "man_ins_prod_13":"0","id_cid":"1","id_cult":"1"}, {"iea_id":"2","man_ins_area_00":"0","man_ins_prod_00":"0","man_ins_area_05":"0", "man_ins_prod_05":"0","man_ins_area_10":"0","man_ins_prod_10":"0", "man_ins_area_13":"0","man_ins_prod_13":"0","id_cid":"2","id_cult":"1"}]
Where: "iea_id": "1" and "iea_id": "2" are two different records.
My doubt is if there is any way to access the "records" strong> as a vector , for mounting a chart?
EDITING WITH THE ERROR:
Fullcodebeingused:
<scripttype="text/javascript" language="javascript">
$(function($) {
$("#formulario").submit(function() {
$("#status").html("<img src='loader.gif' alt='Enviando' />");
$.post('envia.php', {nome: nome}, function(resposta) {
for(var i=0; i<resposta.length; i++) {
var registro = resposta[i];
console.log(registro.iea_id);
}
});
});
});
</script>