3
I am capturing latitude and longitude through the Geolocation plugin of Cordova, and after that I store it in two variables and then, through an ajax request, I transfer these values to a PHP script where I am saving the data in a table called map. The problem is that it executes ajax code, returns success information, nothing else in the database is saved... I can’t find the error.
PHP:
if($_GET['acao']=='btnfinaliza'){
$latitude = $_GET['tlatit'];
$longitude = $_GET['tlongt'];
$SQL = "INSERT INTO mapa (lat, lng) VALUES ('$tlati','$tlong')";
$re = mysql_query($SQL, $serve);
}
Ajax:
$('#btn_finaliza').on('click', function(){
var Cap = function(position){
var coord = position.coords;
var tlatit = position.coords.latitude;
var tlongt = position.coords.longitude;
$tlati = $('tlatit');
$tlong = $('tlongt');
$.ajax({
type: "get",
url: $server+"/conecta.php",
data: "latitude="+$tlati+"&longitude="+$tlong+"&acao=btn_finaliza",
success: function(data) {
intel.xdk.notification.alert('Problema cadastrado', '', 'ok');
}
});
}
});
do:
mysql_query($SQL, $serve) or die(mysql_error());
and see if there are any errors– rray
hello, returned no error...
– G. Vilela