1

I have created modal that loads with default lat-long so when I open the modal it automatically loads that location. I have added a GPS button that can give me the user's current location. Both are in different functions, but now I want current location when modal opens. If I do that, search bar not working with find other location.

function initMap(lat, lng){
  if (lat & lng) {
     lat = parseFloat(lat)  
     lng = parseFloat(lng)
  } else {
     lat = -72.43234
     lng = 1.23423
  }
}

if user getLocation() then it will fetch current location, but it will never retrieve other location in map.

function initMap(lat, lng){
  if (lat & lng) {
     lat = parseFloat(lat)  
     lng = parseFloat(lng)
  } else {
     getLocation()
  }
}

getLocation() {
// code for current location html5
}
rmlockerd
  • 3,776
  • 2
  • 15
  • 25
  • The little snippet of Javascript is not enough to go on. You say geocoder isn't searching, but is there anything in the Rails logs? How are how invoking the search operation? What's the code in your controller doing? – rmlockerd Jul 04 '21 at 08:03

0 Answers0