0

重複の可能性:
jQuery を使用した Google Geo API (リバース ジオコーディング) の解析

  $(window).load(function() {

var purl =  "http://maps.googleapis.com/maps/api/geocode/json?latlng=32.759294499999996,-97.32799089999999&sensor=false";
  $.getJSON(purl,function(result){
    $.each(result, function(i, field){
      $("#data").append(field + " ");
    });
  });

});

URL にアクセスすると、json 形式で結果が表示されます。これを $.getJSON リクエストとして送信すると、firebug の応答で何も返されません。何かご意見は ?

4

2 に答える 2

0

ここで逆ジオコーディングの例を参照してください。

https://google-developers.appspot.com/maps/documentation/javascript/examples/geocoding-reverse

これが彼らの例です(地図を除いて):

  var geocoder;

  function initialize() {
    geocoder = new google.maps.Geocoder();
  }

  function codeLatLng(lat, lng) {
    var latlng = new google.maps.LatLng(lat, lng);
    geocoder.geocode({'latLng': latlng}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        if (results[1]) {
           alert(results[1].formatted_address);
        } else {
          alert('No results found');
        }
      } else {
        alert('Geocoder failed due to: ' + status);
      }
    });
  }

$().ready(function () {
    initialize();
    codeLatLng(32.759294499999996,-97.32799089999999);
});
于 2012-11-08T22:53:20.000 に答える
0
$.ajax({
        type : "GET",
        url : URL,
        dataType : "jsonp",
        jsonp : "jsoncallback",
        jsonpCallback : MSS,
        cache : true,
        success : function(service_data) {
            binding(service_data);

        },
        error : function(msg) {
            alert(JSON.stringify(msg));
        }
    });
于 2012-11-09T10:05:35.063 に答える