I want to write some User Data to a variable place. But I don't know how I can tell this to 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..');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.