Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Firebase Realtime Database Web</title>
- <script>
- // firebase config here
- </script>
- </head>
- <body>
- <h3>Police Station 1</h3>
- <table id="reports" border="1">
- <tr>
- <th>Email Address</th>
- <th>Caption</th>
- <th>Location</th>
- <th>Time</th>
- <th>Picture</th>
- </tr>
- </table>
- <script>
- var tblUsers = document.getElementById('reports');
- var databaseRef = firebase.database().ref('PP3/');
- var rowIndex = 1;
- databaseRef.on('value', function(snapshot) {
- snapshot.forEach(function(childSnapshot) {
- var childKey = childSnapshot.key;
- var childData = childSnapshot.val();
- var row = tblUsers.insertRow(rowIndex);
- var email = row.insertCell(0);
- var caption = row.insertCell(1);
- var location = row.insertCell(2);
- var time = row.insertCell(3);
- var picture = row.insertCell(4);
- email.appendChild(document.createTextNode(childData.Email.replace(/\/g, '').replace(/"/g, '')));
- caption.appendChild(document.createTextNode(childData.Caption.replace(/\/g, '').replace(/"/g, '')));
- location.appendChild(document.createTextNode(childData.Location.replace(/\/g, '').replace(/"/g, '')));
- time.appendChild(document.createTextNode(childData.Time.replace(/\/g, '').replace(/"/g, '')));
- picture.appendChild(document.createTextNode(childData.Picture.replace(/\/g, '').replace(/"/g, '')));
- rowIndex = rowIndex + 1;
- });
- });
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment