Perfect, but won't show a city

LiteCart Fan
Fra Netherlands
Medlem siden nov. 2020

Wow Nice script, only it won't show a city on my webpage.
Anyone a Clue?

tim
Founder
Fra Sweden
Medlem siden mai 2013
tim

It does for me, thinking this is maybe different in different locations? Can you peek in the Network tab under the F12 console what the network request response to openstreetmap.org contains?

LiteCart Fan
Fra Netherlands
Medlem siden nov. 2020

I have the solution!
changing
$(':input[name="city"]').val(data.address.city || '');

to
$(':input[name="city"]').val(data.address.village || '');
worked for me.

Thanks found it in the network tab!

tim
Founder
Fra Sweden
Medlem siden mai 2013
tim

I wonder if this fallback chain will work:
$(':input[name="city"]').val(data.address.city || data.address.village || '');

LiteCart Fan
Fra Netherlands
Medlem siden nov. 2020

He Tim,
It works here!

tim
Founder
Fra Sweden
Medlem siden mai 2013
tim

Excellent, I will update it.

tim
Founder
Fra Sweden
Medlem siden mai 2013
tim

I updated with the following fallback:

$(':input[name="city"]').val(data.address.city || data.address.town || data.address.village || '');

Du
This website uses no cookies and no third party tracking technology. We think we can do better than others and really think about your privacy.