I have a script that makes an ajax call to a php file, the php file returns two values, a lat and a long.
The ajax response is correct, when checking in firebug I get this response:
[{"latitude":"-0.758623","longitude":"52.047870"}]
This is the code I am using to make the call, what I dont understand is why response.latitude
and response.longitude
are returned as undefined:
$.ajax({
type: "POST",
url: "http://www.url.com/route/findRoute",
data: {postcode: postCode},
dataType: 'json',
success: function(response)
{
alert(response.longitude);
}
});
Please can anyone point me in the right direction?
Many thanks
Jim