0
我在我的視圖上有Google Map。ASP.NET MVC 3從Google Map中保存緯度和經度
我希望保存剛剛添加到地圖的標記的長和寬。 我的ViewModel有一個包含lat和long的Location對象。
有誰知道我該如何做到這一點?
以下是代碼:
function addMarker(location, isdragable) {
marker = new google.maps.Marker({
position: location,
map: _gmMap,
icon: '../../Content/images/pin-red_32.png',
draggable: isdragable
});
$('#mainPlaceHolder_hdnlatlong').val(location.lat() + ',' + location.lng());
markersArray.push(marker);
if (isdragable) {
google.maps.event.addListener(marker, 'dragend', function() {
showLocation(marker.getPosition().lat() + ',' + marker.getPosition().lng(), true);
});
}
$('#spmsg').hide();
}
我可以輕鬆地做服務器端代碼。當標記成功放置在地圖上時,我對如何調用操作方法感到困惑。 – Subby