今天,我正在我的网站上工作,我的代码中出现了一个问题:
var ref = new Firebase('https://cryptobox.firebaseio.com/messages');
// SHOW SELECTED MESSAGE ON SELECTOR
function messageRead(uid) {
var uid = uid.replace("#", "");
if(uid != "") {
ref.child(uid).once("value", function(snapshot) {
message = snapshot.val();
$(".email-content-body").text(message.message);
$("#author").text(message.author)
console.log(message)
id = message.parent().name();
});
}
}
messageRead(window.location.hash);
});
在firebase doc上,parent()函数似乎是这样使用的,但是,在Chrome控制台上,我收到了这个错误:
firebase.js:47 Uncaught TypeError: message.parent is not a function
FIREBASE WARNING: Exception was thrown by user callback. TypeError: message.parent is not a function
at http://localhost/crypt/js/main.js:55:18
at c (https://cdn.firebase.com/js/client/2.2.1/firebase.js:218:65)
at https://cdn.firebase.com/js/client/2.2.1/firebase.js:50:642
at Ab (https://cdn.firebase.com/js/client/2.2.1/firebase.js:47:165)
at wb (https://cdn.firebase.com/js/client/2.2.1/firebase.js:22:216)
at xb (https://cdn.firebase.com/js/client/2.2.1/firebase.js:21:1261)
at Bh.h.Cd (https://cdn.firebase.com/js/client/2.2.1/firebase.js:194:472)
at kh.h.Bd (https://cdn.firebase.com/js/client/2.2.1/firebase.js:182:251)
at Zg.Bd (https://cdn.firebase.com/js/client/2.2.1/firebase.js:174:364)
at Rg.hg (https://cdn.firebase.com/js/client/2.2.1/firebase.js:172:281)
你能帮帮我吗?感谢。
(对不起我的英语,我是法国学生:p)