hi,
I am trying to make google maps v3 work with ASP MVC with markers from a database. I got this working fine with version 2 of the api as decribed in an article I found ( http://mikehadlow.blogspot.com/2008/10/using-google-maps-with-mvc-framework.html?showComment=1280600518852#c4603834263614352338 ), but I am unable to convert this v2 code to v3. The problem seems to lie in the getJSON because that breaks everything. I've only edited the google maps code from the article. I'm not getting any errors with firebug.
This is the code I use:
$(function () {
$.getJSON("/Home/Map", initialise);
});
$(function initialise(mapData) {
var myLatlng = new google.maps.LatLng(-25.363882, 131.044922);
var myOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map"), myOptions);
$.each(mapData.Locations, function (i, location) {
setupLocationMarker(map, location);
});
});
$(function setupLocationMarker(map, location) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(location.LatLng.Latitude, location.LatLng.Longitude),
map: map,
title: location.Title
});
});
Can anyone see whats wrong with it?