I am capturing latitude and longitude through the Cordova plugin, 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 to a table called a map. The problem is that it runs the ajax code, returns success information, nothing else in the database is saved ... I can not 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');
}
});
}
});