function showpos(position){
lat=position.coords.latitude
lon=position.coords.longitude
var enderDe = (+lat+',' +lon);
How do I save the enderDe
variable in my database?!
function showpos(position){
lat=position.coords.latitude
lon=position.coords.longitude
var enderDe = (+lat+',' +lon);
How do I save the enderDe
variable in my database?!
According to your answers, using jQuery.post , you can try the following:
function showpos(position) {
lat=position.coords.latitude;
lon=position.coords.longitude;
var latlon = JSON.stringify({lat:lat,lon:lon});
saveLatLon(latlon);
}
function saveLatLon(pos) {
$.post('url/do/teu/php.php',pos,function(data) {
console.log(data); // aqui voce trata data como quiser
}
}
On the php side you will have to do anything like
if (isset($_POST['lat']) && isset($_POST['lon'])) {
// chamada ao MySQL e tratamento de dados aqui
}
In order not to use jQuery, you need to use the XMLHttpRequest to make an AJAX call to your PHP.