2014-09-10 18 views
0

如何獲取ubilabs geocomplete中的formatted_address和其他內容?如何獲取ubilabs geocomplete中的formatted_address和其他內容?

我用戶ubilabs geocomplete。

https://github.com/ubilabs/geocomplete

http://ubilabs.github.io/geocomplete/docs/

如何獲得的formatted_address等。

我爲得到LAT和LNG我用這個代碼:

$("#geocomplete").bind("geocode:dragged", function(event, latLng){ 
$("input[name=lat]").val(latLng.lat()); 
$("input[name=lng]").val(latLng.lng()); 
$("#reset").show(); 
}); 

,但我需要:

location 
location_type 
formatted_address 
street_number 
postal_code 
locality 
sublocality 
country 
country_short 
administrative_area_level_1 
place_id 

如何通過ubilabs geocomplete?

回答

0

,我也有我設法與婁代碼修復它

$("#geocomplete").bind("geocode:dragged", function(event, latLng){ 
      $("input[name=lat]").val(latLng.lat()); 
      $("input[name=lng]").val(latLng.lng()); 
      $("input[name=formatted_address]").geocomplete("find", latLng.lat() + "," + latLng.lng()); 
      $("#reset").show(); 
     }); 

,然後簡單地放在下面從輸入其中同樣的問題你想要顯示格式化地址

<input name="formatted_address" type="text" value=""> 

其工作爐排!

相關問題