Reputation: 371
I have longitude and lattitude positions and now I want to show the longitude and lattitude in google maps ... This is a link through which we can show it for free ... https://www.google.com/maps/@30,70z ...
$('btn-location').click(function () {
var lon = $('longitude').text(); // value here is 70
var lat = $('latitude').text(); // value here is 30
window.location.replace("https://www.google.com/maps/@" + lat + "," + lon + "z");
});
Here is the code using jquery but I am getting error on @ symbol ....
Upvotes: 0
Views: 354
Reputation: 525
Try the following code snippet: @@ is the escape character for @ in Razor views.
$("#btn-location").click(function () {
var lon = $("#longitude").text(); // value here is 70
var lat = $("#latitude").text(); // value here is 30
window.location.replace("https://www.google.com/maps/@@" + lat + "," + lon + "z");
});
Got the result: https://www.google.com/maps/@30,70z
Upvotes: 1
Reputation: 91
As @ is special character in Razor pages you need to escape it. Just use @@
.
Upvotes: 1