[英]Sava Data to a variable Place [Firebase]
I want to write some User Data to a variable place. 我想将一些用户数据写入一个可变的位置。 But I don't know how I can tell this to Firebase. 但是我不知道该如何告诉Firebase。 The normal save function doesn't work with a variable save location. 普通保存功能不适用于可变保存位置。 Like in the example below I want to save the data on a variable save location. 像下面的示例一样,我想将数据保存在变量保存位置。
function Writevariabledata(userId,data)
{
firebase.database().ref('user/testdata/' + userId).set({
$userId: data
});
}
this works for me 这对我有用
function Writevariabledata() {
var name = document.getElementById("name");
var firebaseref = firebase.database().ref("user/testdata/" + userId);
var messagetext = {};
messagetext.cat_name = name.value;
firebaseref.push().set(messagetext);
window.alert('Inserted Successfully..');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.