Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

Displaying data on html page as undefined, Firebase

$
0
0

i am trying to display data from a collection in firebase to my html page, i managed to figure out the following code but my data is displayed as undefiened.. Does anyone have any solution to this?

enter image description here

Here is my code

db.collection("patients").onSnapshot(snapshot => {
    setupGuides1(snapshot.docs);
});

const guideList1 = document.querySelector('.patients');
//setup the patients

const setupGuides1 = (data) => {

  let html = '';
  data.forEach(doc => {
     const patients = doc.data();
     table= `<table"><tr><td style="text-align: center">${patients.name1}"</td></tr><tr><th style="text-align: center">${patients.phone1}</th></tr><tr style=""padding-top:20px;><td style="text-align: center">${patients.specialist1}</td></tr><tr><td style="text-align: center">${patients.date}</td></tr></table>
     `;
     html += table;
   });
      guideList1.innerHTML = html;
  }

Viewing all articles
Browse latest Browse all 138163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>