我想刷新Google地圖併發送新的地理定位請求,而無需刷新頁面,同時用戶在輸入時鍵入地址(城市和地址,國家不變)。我怎樣才能做到這一點?如何在輸入地址時輸入新的地理定位請求並刷新Google地圖?
<input type="text" id="input_adress" />
<script type="text/javascript">
function mapk() {
//code about start the map (new google.maps.Map)...
geokoder.geocode({address: 'UK'}, start_geocode);
}
function start_geocode(var1, status) {
//more code...
</script>
現在是我要開始代碼:
$(function()
{$('#input_adress').keyup(function() {
});
});
我不知道應該怎樣下?可能我需要先選擇地圖...
geokoder.geocode({address: 'UK '+$('#input_adress').val()}, start_geocode);
我在我的頁面上有jQuery庫。這夠了嗎?