Hi I'm using google places api javascript sdk , and want to save the result in my db using ROR - I'm wondering that four day earlier , it was saving the lat/lng successfully but now it's saving as null . Below is my explanation
I've this code in my javascript
places = new google.maps.places.PlacesService(map);
places.nearbySearch(request, callback);
function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
clearMarkers();
//alert(JSON.stringify(results));
$.ajax({
url: "/myurl",
data:{
'google_searched_locations': JSON.stringify(results)
},
dataType: "json",
method: 'post',
async : false,
success: function(data){
}
});
}
In the callback function when i do console.log(results[0].geometry.location.lng()); it shows me result as 74.30889000000002 while when i do
console.log(results[0]);
Output
geometry
Object { location=L}
location
L { lat=function(), lng=function(), toString=function(), more...}
equals function(a)
j function(a)
lat function()
lng function()
toString function()
which clearly makes sense . But in console of firefox , ajax data parameter showing the data in the following form
[{"geometry":{"location":{}}]
I skipped the other parameters for clarity because all other things are present in the request . But you can see location is totally
empty , Why ? and how can i send results[0].geometry.location.lng() values alongwith i.e within location object