Try this
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
Pregunta
Having problems getting lat & lng from googles response.
Google is responding some xml looking like :
"location" : {
"lat" : 53.55914120,
"lng" : 10.00923520
},
I´m parsing this with var r = results[0].geometry.location;
and alerting (r) says:
(53.55914120,10.00923520)
now the problem :
When i try var r = results[0].geometry.location.lat;
and alerting (r) says:
function (){return this[a]}
so my question is:
when r = results[0].geometry.location;
r = (53.55914120,10.00923520)
how do i get lat and lng from it ?
alert(r[0]r[1]) <!-- doesn´t work, returns "undefined" -->
or
how can i store lat & lng in two different variables from the beginning,
Thanks in advance
i expected var r = results[0].geometry.location.lat;
but that doesn´t work
Solución
Try this
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();