/ / HTML5 Геолокація зберегти в базі даних - jquery, html5, геолокація

HTML5 Geolocation зберегти в базі даних - jquery, html5, геолокація

У мене простий скрипт геолокації HTML5.

<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>

Питання в тому, як я можу отримати position.coords.latitude & position.coords.longitude і помістити його в мою базу даних?

Я сподіваюся, що хтось може мені допомогти.

Відповіді:

1 для відповіді № 1

Ви можете виконати повідомлення про Ajax таким чином:

$.post("recv.php", position.coords)

а потім внесіть php в базу даних.