Algolia Places not able to make it work

Hi there,

This is my first time using Algolia solutions, so… I apologize up front if my question is naive.

I’m trying to set up Algolia Places, for an input… just like in the example page. But I havent been able to have “places” object available on the page.

So, even the Simple Input example won’t work.

var placesAutocomplete = places({
container: document.querySelector(’#address’)
});

It says “places is not defined”.

The file is linked via CDN, it get downloaded correctly… but “places” is not available in the console either.

https://cdn.jsdelivr.net/places.js/1/places.min.js

This is what is it available on page:

__algolia.algoliasearch

Any help would be very appreciatted… please!

Thanks,

Rami.

OK, I figured it out…

Some evil script were overwritting the places object. I just move the link down on the load stack.

I think “places” is a very common name for a global variable. dont you think?


UPDATE (Not solved):

I thought I got it solved… but I didnt.

When importing the library from CDN in a blank page, works perfectly. But my current project already have lots of javascript plugged in.

Even when I place the CDN link last in the stack… still places is not available.

Is there a way of initialize the “places” plugin manually??

Thanks

Rami.

SOLVED

In my case, I had “retina.js” before “places.min.js”… it didnt work.

After I put places.min.js before it, now places is available.

Retina’s link:
https://imulus.github.io/retinajs/

Good luck to all.

1 Like