The code below shows how I show the Google map to get current position using js. But now I want it to fetch the lat and long from firebase collection to show someone's else location. Can someone help me guide through please?
x = navigator.geolocation;
x.getCurrentPosition(success,failure);
function success (position) {
var myLat = position.coords.latitude;
var myLong = position.coords.longitude;
var coords = new google.maps.LatLng(myLat,myLong);
var mapOptions = {
zoom: 14,
center: coords,
mapTypeID: google.maps.MapTypeId.RoadMap
}
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var marker = new google.maps.Marker({map:map, position:coords});
}
function failure(){}