dimanche 6 mai 2018

Retriving data from firebase web

I am trying to fetch the data for website using java script. Problem I am getting is that I am unable to get the key of Users-->history-->location-->from-->(lat,lng). I am unable to find a syntax of it.

Image of database

Code I am trying is

   var ref = firebase.database().ref("history/" + keys  +"/location/from");

ref.on('value',gotDataa,errDataa);

function gotDataa(data){
    //console.log(data.val());
    var from = data.val();
    var keys=Object.keys(from);
    console.log(keys);
    for(var i=0 ; i<keys.length;i++)
    {
        var k=keys[i];
        var name = from[k].customer;
        var phone = from[k].driver;

        //console.log(name,phone,imag);
        $('ul').append( '<li>' + name +" : " + phone+ '</li>' );
    }
}

error in code




Aucun commentaire:

Enregistrer un commentaire