我基本上是想构建一个Chrome应用程序(使用HTML和JavaScript),在其中我要:
Google Maps JSON API:http : //maps.googleapis.com/maps/api/geocode/json?address = Vancouver
在chrome应用程序中,我知道我可以使用HTML和JavaScript / jQuery(如果我对jQuery有误,请改正我)。我不确定如何使用JavaScript / jQuery和调用上述API并消耗特定值。
您可以使用jQuery REST Client,易于实现
编辑
添加此库:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://jpillora.com/jquery.rest/dist/1/jquery.rest.min.js"></script>
要解决"Vancouver"
它并将其存储在变量中,应该是:
var longName = null;
var client = new $.RestClient('http://maps.googleapis.com/maps/api/');
client.add('geocode', {stripTrailingSlash: true});
client.geocode.read('json', {address: 'Vancouver'}).done(function (data){
longName = data.results[0].address_components[0].long_name;
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句