我无法弄清楚我做错了什么,我的firebase数据库没有收到新的条目。 这是我的功能
function addBusiness() {
var database = firebase.database();
var fname = document.getElementById('first-name').value;
var lname = document.getElementById('last-name').value;
var businessname = document.getElementById('business-name').value;
var email = document.getElementById('email').value;
var password = document.getElementById('password').value;
// var Author = firebase.auth().currentUser.uid
var logo = document.getElementById('fileToUpload').value;
var roofRef = firebase.database().ref();
var businessRef = roofRef.child('Businesses');
businessRef.push({
Business: businessname,
email: email,
logo: logo,
});
}
我也尝试过businessRef.push()。set {}但仍未成功。请帮忙!
答案 0 :(得分:0)
您可以直接在ref中使用子名称,如下所示。
var roofRef = firebase.database().ref('Businesses');
roofRef.push({
Business: businessname,
email: email,
logo: logo
});