使用Google API - GClientGeocoder()

use*_*207 8 api google-maps

我尝试按照此页面操作:

http://melandri.net/2009/07/03/get-location-coordinates-using-google-maps/
Run Code Online (Sandbox Code Playgroud)

但是GClientGeocoder()没有定义 - 有一个错误.

我已经在我的页面上使用google maps api了:

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=<%=System.Web.Configuration.WebConfigurationManager.AppSettings["myGoogleKey"]%>&sensor=false"></script>
Run Code Online (Sandbox Code Playgroud)

如何解决我的错误?

以下是我成功使用API​​的方法:

var map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
Run Code Online (Sandbox Code Playgroud)

And*_*ach 21

GClientGeocoder()是版本2对象.您正在加载版本3 API并需要使用版本3对象和方法.

版本3等效于文档中google.maps.Geocoder()描述.它与版本2实现不同.