Google’s Places API and JQuery request – Origin http://localhost is not allowed by Access-Control-Allow-Origin

You’re trying to use the Places API web service, which is meant for use from server code and does not support the JSONP output you’d need for JavaScript.

In JavaScript, you need to use the Places Library from the Maps API V3. You can’t just hit a URL directly from JavaScript or jQuery code. (You could probably discover the URL pattern that the Places Library uses, but the terms of service don’t allow direct use without going through the API/Library, and the URL could change at any time.)

Is there a reason you don’t want to use the Maps API from JavaScript?

Leave a Comment