I have created a function that tries to get lat long based on the address and after that, I want those to print on console
How to get values of coords.... am I doing it in the correct way? please help to understand it.
coords = getLocationCoords("Ambala,Haryana,India,134003");
console.log(coords)
function getLocationCoords(fa){
var coords = [];
$.get(location.protocol + '//nominatim.openstreetmap.org/search?format=json&q='+fa, function(data){
coords['lat'] = JSON.parse(data[0].lat);
coords['lon'] = JSON.parse(data[0].lon);
});
return coords;
}//getLocationCoords