Guest User

Untitled

a guest
Oct 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Firebase Realtime Database Web</title>
  4. <script>
  5. // firebase config here
  6. </script>
  7. </head>
  8. <body>
  9. <h3>Police Station 1</h3>
  10. <table id="reports" border="1">
  11. <tr>
  12. <th>Email Address</th>
  13. <th>Caption</th>
  14. <th>Location</th>
  15. <th>Time</th>
  16. <th>Picture</th>
  17. </tr>
  18. </table>
  19.  
  20. <script>
  21. var tblUsers = document.getElementById('reports');
  22. var databaseRef = firebase.database().ref('PP3/');
  23. var rowIndex = 1;
  24.  
  25. databaseRef.on('value', function(snapshot) {
  26. snapshot.forEach(function(childSnapshot) {
  27. var childKey = childSnapshot.key;
  28. var childData = childSnapshot.val();
  29.  
  30. var row = tblUsers.insertRow(rowIndex);
  31. var email = row.insertCell(0);
  32. var caption = row.insertCell(1);
  33. var location = row.insertCell(2);
  34. var time = row.insertCell(3);
  35. var picture = row.insertCell(4);
  36. email.appendChild(document.createTextNode(childData.Email.replace(/\/g, '').replace(/"/g, '')));
  37. caption.appendChild(document.createTextNode(childData.Caption.replace(/\/g, '').replace(/"/g, '')));
  38. location.appendChild(document.createTextNode(childData.Location.replace(/\/g, '').replace(/"/g, '')));
  39. time.appendChild(document.createTextNode(childData.Time.replace(/\/g, '').replace(/"/g, '')));
  40. picture.appendChild(document.createTextNode(childData.Picture.replace(/\/g, '').replace(/"/g, '')));
  41. rowIndex = rowIndex + 1;
  42. });
  43. });
  44.  
  45.  
  46. </script>
  47. </body>
  48. </html>
Add Comment
Please, Sign In to add comment