I’m trying to use HTML5’s native Geolocation API to search around a user’s actual long/lat rather than around their IP.
The long/lat that I get from my JS is correct.
For example, if I hardcode those like so
algoliaHelper.setQueryParameter('aroundLatLng', '55.809708199999996, -4.1557824')
Things work as I’d expect.
However, if I do
userLat = position.coords.latitude, userLng = position.coords.longitude const theFinalPositionIs = "'" + userLat + ", " + userLng + "'" console.log(theFinalPositionIs) algoliaHelper.setQueryParameter('aroundLatLng', theFinalPositionIs)
I get an API error “Invalid value for “aroundLatLng” parameter, expected float”
What am I missing?
I’ve tried using template string as well but no joy there either.