Advertisement:

Author Topic: Algolia Place in search bar home page  (Read 49 times)

warren mchugh

  • Newbie
  • *
  • Posts: 3
Algolia Place in search bar home page
« on: July 04, 2019, 07:16:42 pm »
Hi Everyone,


I just search in forum i found something helpful from other topics. I copied the below code which is reading the cities, However i want to integrate Algolia script into my website. Anyone helpful around to assist me in this issue thanks Appreciate your time.

 <input type="search" id="city" class="form-control" placeholder="In which city do you live?" />

<script src="https://cdn.jsdelivr.net/npm/places.js@1.16.4"></script>
<script>
(function() {
  var placesAutocomplete = places({
    appId: 'plAEP8U2J9AD',
    apiKey: 'd5f82d9200b53c68823eab9391127e8c',
    container: document.querySelector('#city'),
    templates: {
      value: function(suggestion) {
        return suggestion.name;
      }
    }
  }).configure({
    type: 'city',
    aroundLatLngViaIP: false,
  });
})();
</script>



This is the Algolia script need to do funtion in os class like above

<input type="search" id="city" class="form-control" placeholder="In which city do you live?" />

<script src="https://cdn.jsdelivr.net/npm/places.js@1.16.4"></script>
<script>
(function() {
  var placesAutocomplete = places({
    appId: '<YOUR_PLACES_APP_ID>',
    apiKey: '<YOUR_PLACES_API_KEY>',
    container: document.querySelector('#city'),
    templates: {
      value: function(suggestion) {
        return suggestion.name;
      }
    }
  }).configure({
    type: 'city',
    aroundLatLngViaIP: false,
  });
})();
</script>