I am using this code to get the latitude and longitude of current location.
<script>
var x=document.getElementById("demo");
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
else{x.innerHTML="Geolocation is not supported by this browser.";}
}
function showPosition(position)
{
x.innerHTML="Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
i need to pass the longitude and latitude from this ajax code to google map's LatLng variable how to this.
This is the google maps api code that i am using
function initialize() {
var latlng = new google.maps.LatLng(52.000,17.1100);
var myOptions = {
zoom: 12,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
Can anyone help me..thanks in advance :)