I am trying to get two variables (long and lat) from my PHP associative array - like so:
$lnglat = array( 'latitude' => "$lat2",
'longitude' => "$lon2" );
json_encode($lnglat);
I then use jQuery on my HTML page where the PHP file is included. The jQuery is at the bottom of the page, and contains:
jQuery.ajax({
type: 'GET',
url: '/phppage.php',
dataType : 'json',
success: function (lnglat) {
map.addMarker({
lat: arr[0],
lng: arr[1],
title: 'Lima',
infoWindow: {
content: '<p>SAMPLE TEXT <br> Map Marker</p>',
}
});
}
});
However nothing is outputted, despite me having data in the array (as I echo this on my PHP page).