0
我是新來的兩個JSON &谷歌地圖。jQuery getJSON()不能與谷歌地圖API
$(function() {
$("#search").click(function() {
$.getJSON("http://maps.googleapis.com/maps/api/geocode/json?address=awan%20town&sensor=false", function (result) {
$.each(result, function (i, field) {
$.("#map-canvas").append(field + " ");
});
});
});
});
:所以,請告訴我,我很想念
<!DOCTYPE html>
<html>
<head>
<script src="https://maps.googleapis.com/maps/api/js?v=3.15&sensor=false"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
$function({
$("#search").click(function(){
$.getJSON("http://maps.googleapis.com/maps/api/geocode/json?address=awan%20town&sensor=false",function(result){
$.each(result,function(i,field){
$("#map-canvas").append(field + " ");
});
});
});
});
</script>
</head>
<body>
<button id="search">Search</button>
<div id="map-canvas" style="width:100%;height:100%;"></div>
</body>
</html>
這裏還沒有工作 –
你想從返回的JSON中獲得什麼字段? – Felix
我想我寫的代碼會從這個URL返回所有的,我真的想得到任何特定的領域如何做到這一點 http://maps.googleapis.com/maps/api/geocode/json?address=awan%20town&sensor = false –