Add the following snippet to the
<head> tag of your site.
To begin with the Localities Service, you need to build a new
AutocompleteService object passing the
key parameter corresponding to your project public key.
const key = 'woos-xxxx'; //your project public key let autocompleteService = new woosmap.localities.AutocompleteService(key);
Here are two code samples to help you use the Localities JS API.
keyup event fired on the dedicated text
getQueryPredictions() is called and results displayed below.
To understand how to go deeper with the Localities JS API, please check the Localities JS API Reference.
description field is used to display suggestions.
In this example, we format the result string manually before displaying it, so the
description field from results is not used. A custom description is built instead, using other fields from the results. In this case, when searching for a postal code, suggestions are built from the fields
admin_0. When searching for a city name, suggestions come from the basic