When I try to pull the data this is what happens, I am using child_added to be real-time. I feel like I have to convert it to a string/but I do not know how Sorry for my english here is the js file
$(document).ready(function(){
var config = {
apiKey: "AIzaSyB9p1VvVfhnbrcDwUKUuSqw9aQsqnDi4nQ",
authDomain: "html5project-870df.firebaseapp.com",
databaseURL: "https://html5project-870df.firebaseio.com",
projectId: "html5project-870df",
storageBucket: "html5project-870df.appspot.com",
messagingSenderId: "54935462861"
};
//firebase.initializeApp(config);
if (!firebase.apps.length) {
firebase.initializeApp({});
}
var database = firebase.database();
var Rootref = database.ref().child("users");
Rootref.on("child_added", snap => {
var test = "test5765";
var name = snap.child("user").val;
console.log(name);
$("#read").append("<tr><td>"+name+"</td></tr>");
```
Here is the result
function(){return Fn("DataSnapshot.val",0,0,arguments.length),this.node_.val()}
function(){return Fn("DataSnapshot.val",0,0,arguments.length),this.node_.val()}
function(){return Fn("DataSnapshot.val",0,0,arguments.length),this.node_.val()}
It posts three times because there are three events
Any help is appreciated
Here is the github link
https://github.com/SaiVeer04/transcriber/blob/master/read.js
Aucun commentaire:
Enregistrer un commentaire