0
json
[
{
"idDisciplina":"1",
"0":"1",
"Nome":"Matematica",
"1":"Matematica"
},
{
"idDisciplina":"11",
"0":"11",
"Nome":"Ciencia",
"1":"Ciencia"
}
]
script
$.ajax({
url: "includes/disciplina.php/",
type: "POST",
data: {
id: id
},
success: function(json) {
$("#idDiciplina").html("");
console.log(json);
$('#idDiciplina').append("<option value='' selected='selected'>Disciplinas</option>");
for (var i = 0; i < json.length; i++) {
$('#idDiciplina').append("<option value=" + json[0][i] + ">" + json[1][i] + "</option>");
}
}
});
Mt good, with reduce is even better. reduce()
– teliz
Gives this error here ó: Uncaught Typeerror: json.reduce is not a Function
– Esdras Fragoso