Jan 30, 2021
Calling Places API using Ajax on browser side giving CORS error
We have generated the Google Places API and by calling the below API we can get the result.
But, when I call using Ajax on the browser side. It gives me the below error.
jquery-1.8.0.js:8241 Access to XMLHttpRequest at 'https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Ahmedabad&key=MY-API-KEY&sessiontoken=1234567890' from origin 'http://localhost:5137' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Google Maps JavaScript API error: ApiNotActivatedMapError
We have enabled only Places API, not the Maps JavaScript API. Do we need to enable it? Now, what we need to do to use API on the client-side using ajax? Please advise.
Details
Community content may not be verified or up-to-date. Learn more.
Last edited Jan 30, 2021
All Replies