Can Google Maps/Places 'autocomplete' API be used via AJAX?

后端 未结 8 760
广开言路
广开言路 2020-12-14 11:34

I\'m trying to use the Google Places autocomplete API to pre-fill a form on a web application with Establishment data to ease data-entry. The API is pretty straightforward,

8条回答
  •  醉梦人生
    2020-12-14 12:33

    The Google probably allows this API only called through its own Javascript API which you load from maps.google.com served Javascript file. The lack of Access-Control-Allow-Origin header tells that you should not use the API otherwise through Javascript.

    Alternatively you can simply write a server-side proxy function which calls Google API and passes the result forward to your own $.getJSON call, but this would be probably against the Terms of Service.

    http://www.daniweb.com/web-development/php/code/216729

    (disclaimer: I have not read the API spec for this particular function call)

提交回复
热议问题