I have the following problem. The code recognizes that there is something and shows all the entries, but not the content, but only displays [object object]. I really want to read everything that is in the category "abgeschlosseneAuftraege" and also all subcategories. But for now I try to read at least 1 entry. I would be very grateful for help.
firebase.database().ref("/abgeschlosseneAuftraege").on('value', function(snapshot){
let elm = document.getElementById("data");
elm.innerHTML = '';
snapshot.forEach(function(childSnapshot){
var childKey = childSnapshot.key;
var childData = childSnapshot.val();
elm.innerHTML += childData['Accepted'];
})
})
getData();
[object Object]is what you get when you use an object where a string is required. SochildData['Accepted']must be an object. What doesconsole.log(childData['Accepted'])show?childSnapthot.val()has to be an object so you can usechildData['Accepted'].