新手问题 如果实现搜索城市

xfstart07 · March 12, 2015 · Last by gyorou replied at March 13, 2015 · 2021 hits

最近在实现输入框自动补全搜索城市的功能,目前实现的方式是使用 Google Maps 服务。 不过显示出来的数据列表并不理想,很多不需要的数据也显示出来了。

目前实现的效果:

希望显示的只是城市信息而已,想问一下有没有好的一些服务或者方法实现这方面的功能?

目前使用的 js

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

使用的 gem

gem 'gmaps-autocomplete-rails

更新

使用 Google Maps API V3, https://developers.google.com/maps/documentation/javascript/examples/places-searchbox

效果:

You need to Sign in before reply, if you don't have an account, please Sign up first.