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: