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

后端 未结 8 780
广开言路
广开言路 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:14

    To make cross-domain AJAX calls like this, you should use JSONP with a callback. However, Google doesn't provide a JSONP interface for Autocomplete.

    You might be able to use this Autocomplete class instead, though it doesn't seem possible to style the dropdown.

    EDIT There may be a way to do this. Check out the geo-autocomplete jQuery Plugin. It has two demos. I haven't given this a proper look over yet however.

提交回复
热议问题