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); } 

jsfiddle


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -