Saturday 10 June 2017

'undefined' error when trying to access Firebase DB using JavaScript

This is what I have saved in DB enter image description here

This is my code which I used to try to access the data.

The goal is to get the value of the 1st id

var ref = db.ref("server/events/data");
ref.once("value", function(snapshot) { 

  var ids = snapshot.val();
  console.log(ids.id);

});

What am I missing ?



via Suhaib

No comments:

Post a Comment