0
Es funktioniert wie folgt:Wie übergibt man einen String-Wert an Firebase child()?
var areaCodex = document.getElementById("areaCode");
var x = areaCodex.toString();
firebase.initializeApp(config);
var rootRef = firebase.database().ref().child(x);
$('#saveBtn').click(function() {
rootRef.set({
date: $('#date').val(),
timeF: $('#fromTime').val()
});
})
I-Daten zu Firebase und mein Code ist wie folgt speichern müssen:
var toTime = document.getElementById("toTime");
var areaCode = document.getElementById("areaCode");
function submitClick(){
var firebaseRef = firebase.database().ref().child();//here in .child() i need to pass the areaCode as an argument. It works when i hardcode a value like .child('1234'). But i need that to be what ever the value I am getting from the textbox of areaCode. I have tried //var x = areaCode.value; // var y = x.toString and var y = String(x); , trying to pass y as .child(y)
// also var y = areaCode.toString(); does not work.
var toTimeText = toTime.value;
firebaseRef.child("toTime").set(toTimeText);
window.confirm("Data has been successfully sent.");
}
var firebaseRef = firebase.database().ref().child(document.getElementById("areaCode").value);
oder Vorschläge x
wie dies passieren
Jede Hilfe sehr geschätzt.
dieser Code erinnern in einigen –
Hallo, Antonio Thanx für die Beantwortung. Hier ist was .ref (path_to_your_child); ? – angels65
Mein erster Knoten ist die Vorwahl. Darunter muss ich den toTime Wert haben – angels65