希望获得一些帮助,以便将数据保存到Firebase数据库。我在控制台中收到此错误"第一个参数包含未定义的属性"。任何帮助或建议解决这个问题都将受到大力赞赏。
//Edit Profile
document.getElementById("profileSubmit").addEventListener('click', function(){
var user = firebase.auth().currentUser;
var name, email, photoUrl, uid;
if (user != null) {
name = user.displayName;
email = user.email;
photoUrl = user.photoURL;
uid = user.uid;
}
var username= document.getElementById("username");
var pathway= document.getElementById("pathway");
var avatar= document.getElementById("avatar");
if(username !== "" && pathway !== ""){
// Gets the users input
var getUsername = username.value;
var getPathway = pathway.value;
//var getAvatar = avatar.value;
var editRef= firebase.database().ref("Users/" );
editRef.child(uid).set({
DisplayName: getUsername,
Pathway: getPathway,
})
//Updates Firebase profile
user.updateProfile({
displayName: getUsername
})
$('#successBox').show();
$('#successBox').fadeOut(5000);
$('#username').val("");
$('#pathway').val("");
} //else {
// $('#errorBox').show();
//$('#errorBox').fadeOut(5000);
//}
});