mardi 8 mai 2018

Adding all marker fetched from Firebase database

I am working with java script and firebase. I have already fetched the Lat and lng from firebase. Now the problem is I have not work with map and I am able to add the marker of last user and I want to add all markers of all users fetched from firebase database bot lat and lng are in a different diffrent variable.

Lat Lng fetched from firebase

    $(document).ready(function(){
var rootRef = firebase.database().ref().child("driversAvailable");
rootRef.on("child_added",snap=>{
    var lat = snap.child("l").child("0").val();
    var lng = snap.child("l").child("1").val();
    console.log(name,phone);

    $('ol').append( '<li>' + lat +" : " + lng + '</li>' );

    var uluru = {lat: lat, lng: lng};
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 15,
      center: karachi
    });
    var marker = new google.maps.Marker({
      position: uluru,
      map: map
    });
});

I want to add all user marker fetched from the database.

Aucun commentaire:

Enregistrer un commentaire