admin管理员组文章数量:1384222
I have coordinates in a text box with a button. I am trying to take my coordinates from the text box and concatenate with the google maps. I do not want to show any map or something on my website. I just want to take my coordinates from the text box and open map in new tab with coordinates. My current logic:
var coordinates = $('#coordinates').val();
var url = "/"+ coordinates +",12.21z?hl=en"
$("#map").on('click', function () {
window.open(url, '_blank');
});
Modification: I want to show something like this with marker:
and It showing this:
I have coordinates in a text box with a button. I am trying to take my coordinates from the text box and concatenate with the google maps. I do not want to show any map or something on my website. I just want to take my coordinates from the text box and open map in new tab with coordinates. My current logic:
var coordinates = $('#coordinates').val();
var url = "https://www.google..sa/maps/"+ coordinates +",12.21z?hl=en"
$("#map").on('click', function () {
window.open(url, '_blank');
});
Modification: I want to show something like this with marker:
and It showing this:
Share Improve this question edited Jun 14, 2017 at 7:28 Armaan Labib asked Jun 14, 2017 at 7:13 Armaan LabibArmaan Labib 1651 gold badge2 silver badges16 bronze badges 2- what's not working with the above code? – Deblaton Jean-Philippe Commented Jun 14, 2017 at 7:15
- The problem is its not showing marker in map? – Armaan Labib Commented Jun 14, 2017 at 7:24
1 Answer
Reset to default 7var coordinates, url;
$("#map").on('click', function () {
coordinates = $('#coordinates').val();
url = "https://www.google..sa/maps/search/"+ coordinates +",12.21z?hl=en";
window.open(url, '_blank');
});
For zooming you need to play with these values:
本文标签: How to open Google Map in another tab with your coordinates in JavaScriptStack Overflow
版权声明:本文标题:How to open Google Map in another tab with your coordinates in JavaScript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743932368a2564078.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论