Just made my first post! I was wondering about a javascript issue...here's the code I'm working with:
<html>
<head>
<title>Geolocation Demo</title>
</head>
<body>
<h1>Geolocation Demo</h1>
<p>Latitude: <span id="lat">0.00</span> Longitude: <span id="lon">0.00</span> City: <span id="city">Loading...</span></p>
<p><a id="city_link" href="http://tinygeocoder.com/" target="_blank">View City</a></p>
<p><a id="gmaps_link" href="http://maps.google.co.uk/" target="_blank">View on Google Maps</a></p>
<script language="javascript">
// display geolocation info and create links
function showPosition(position) {
var lat = position.coords.latitude;
var lon = position.coords.longitude;
document.getElementById("lat").innerHTML = lat;
document.getElementById("lon").innerHTML = lon;
var gmaps_url = "http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=" + lat + "+" + lon;
var city_url = "http://tinygeocoder.com/create-api.php?g=" + lat + "," + lon;
document.getElementById("gmaps_link").href = gmaps_url;
document.getElementById("city_link").href = city_url;
}
</script>
</body>
</html>
This script is focused on my geolocation. The Latitude and Longitude are displaying correctly. Additionally, I want to show the location information (like the city). I discovered a website where I can input coordinates and receive a region name in return. My question is if it's possible to automatically populate the "City" field with the region name without clicking the "View City" link but by directly passing the content of the webpage here. This page only contains the name, no additional HTML tags!
Thanks for any help!