有人可以帮助我确定为什么我似乎无法将用户数据保存在Web应用程序的Firebase数据库中吗?我已经完成了必要的链接,甚至更改了数据库安全规则以对所有人进行读/写。但是仍然没有。我该怎么办?下面是我的代码。
HTML
<div class="wrapper">
<div class="mdl-grid">
<div class="mdl-layout-spacer"></div>
<div class="mdl-card mdl-shadow--6dp ">
<div class="mdl-card__title mdl-color--primary mdl-color-text--white">
<h2 class="mdl-card__title-text" style="left: 60px;position: relative;">User Information</h2>
</div>
<div class="mdl-card__supporting-text">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="user_name"/>
<label class="mdl-textfield__label" for="sample3">User Name</label>
</div>
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="walletaddress"/>
<label class="mdl-textfield__label" for="sample3">Bitcoin Wallet Address</label>
</div>
</div>
<div class="mdl-card__actions mdl-card--border">
<div class="mdl-grid">
<button id="savebtn" class="mdl-cell mdl-cell--12-col mdl-button mdl-button--raised mdl-button--colored mdl-js-button mdl-js-ripple-effect mdl-color-text--white">
Save Information
</button>
</div>
</div>
</div>
<div class="mdl-layout-spacer"></div>
</div>
</div>
JavaScript
$("#savebtn").click(
function() {
var username = $("#user_name").val();
var wallet_address = $("#walletaddress").val();
var uid = firebase.auth().currentUser.uid;
if(email != "" && password != ""){
firebase.database().ref().child('Users').child(uid).set({
username_id: username,
address_wallet: wallet_address
});
}
}
);
我想以这种格式保存数据;
Users {
userid {
username: blah blah,
address: blah blah
}
}
请帮助。