javascript - Send latitude-longitude argument to Google Maps -
i have following code:
function initialize(lat, lng) { window.open("https://maps.google.com/?q=<lat>,<lng>"); }
can tell me how send lat/lng arguments google maps in url?
edit - right now, values being sent maps "lat" , "lng", not actual values such 5 , 10. can tell me how send actual values in call maps?
example
html:
<a href="#" class="map-btn" data-lat="41.8911684" data-lng="12.507724100000019"> show map </a>
javascript:
$(function(){ $('.map-btn').click(function(event) { var lat = $(this).data('lat'); var lng = $(this).data('lng'); showmap(lat,lng); }); }); function showmap(lat,lng){ var url = "https://maps.google.com/?q=" + lat + "," + lng; window.open(url); }
Comments
Post a Comment