I'm trying to move a couple of variables from a database, to a php file and then to a html file. I'm calling the php file, using AJAX within the JavaScript in the html file. I think there might be something wrong with the way I'm handling the result.
PHP
<?php
//declare database variables
header('Content-type: text/html; charset=utf-8');
$username = "ishuttle";
$password = "";
$hostname = "localhost";
$dbname   = "ishuttle_taxi-location";
$conn = mysql_connect($hostname, $username, $password);
if (!$conn) {
    die('Could not connect: ' . mysql_error());
}
//search database for driver location
mysql_select_db('ishuttle_taxi-location');
$result = mysql_query($sql);
$sql = "SELECT _id, Latitude, Longitude FROM driver_location WHERE _id = 2";
$retval = mysql_query($sql, $conn);
if(!$retval) {
    die('Could not get data: ' . mysql_error());
}
while($row = mysql_fetch_assoc($retval)) {
    $Lat  = $row['Latitude'];
    $Long = $row['Longitude'];
} 
JS
var Lat = 1;
var Long = 1; {
    $.ajax({
        type: "POST",
        url: "get_driver_location.php", //target file
        success: function(echo) {
            Lat = (echo['Lat'])
            Long = (echo['Long'])
        }
    });
Cheers :)
 
    