I am making a “friend finder” web-based mobile app for school. Now i retrieve the Latitude and longtitude coordinates via GPS , when i retrieve those i want my script to center the map at these coordinates and place a marker there But it won’t work and i’m out of ideas , so can anyone help me ?.
My code : [php]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Find Friends Web App</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script src="scripts/jquery.ui.map.js"></script>
<script>
$(document).ready(function(){
navigator.geolocation.getCurrentPosition(useposition);
});
function useposition(position){
lat = position.coords.latitude;
lon = position.coords.longitude;
$("location")( lat + ', ' + lon);
}
</script>
</head>[/php]
As you can see i fetch the lat,long coordinates and try to store them in location. Then i try to center my map at the lat,long coordinates stored in location. But it won’t work