我从firebase数据库下载了数据并且数据很好但是当这些数据被加载到HTML时,所有表格TD都显示未定义,无法理解为什么检查了很多代码无法理解这里的错误。< / p>
谢谢
var registration = firebase.database().ref("REGISTRATION")
dataRef = firebase.database().ref().child("REGISTRATION");
dataRef.on("value", rData);
function rData(data){
console.log(data.val());
var gData = data.val();
for (gDatarow in gData)
{
alert(email);
var email = gDatarow.email;
var name = gDatarow.name;
var gender = gDatarow.gender;
var date = gDatarow.date;
var phone = gDatarow.phone;
var state = gDatarow.state;
var school = gDatarow.school;
var clas = gDatarow.clas;
var classname = gDatarow.classname;
$("#reData").append("<tr><td>" + email + "</td></td>" + name + "</td><td>" + gender + "</td></td>" + date + "</td><td>" + phone + "</td></td>" + state + "</td><td>" + school + "</td></td>" + clas + "</td><td>" + classname + "</td></tr>");
}
}
答案 0 :(得分:0)
这就是我的情况:
dataRef.on("child_added", function(data) {
var rData = data.val();
$("#reData").append("<tr><td>" + rData.email + "</td><td>" + rData.name + "</td><td>" + rData.gender + "</td><td>" + rData.birthdate + "</td><td>" + rData.phone + "</td><td>" + rData.state + "</td><td>" + rData.school + "</td><td>" + rData.class + "</td><td>" + rData.classname + "</td></tr>");
});
感谢所有人的时间。