I am just starting out with Google Maps API v3 and jQuery. I have made maps before with the v2 API, but it didn't use jQuery. This way will hopefully help me learn some more jQuery on the way. I am following the example on the Google Maps API Tutorial and trying to get their most basic hello world work with jQuery. I am also using the Google Maps API3 Visual Studio Intellisense helper.
My main page is as follows:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Map Page</title>
<link href="style/main.css" rel="stylesheet" />
<script src="scripts/jquery-1.10.2.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
<script src="scripts/google-maps-3-vs-1-0.js"></script>
<script src="scripts/mdaMap.js"></script>
<script type="text/javascript">
$(function () {
map = new google.maps.Map($("#map-canvas"), startMapOptions);
});
</script>
</head>
<body>
<div id="map-canvas" />
</body>
</html>
mdaMap.js contain's the following:
/// <reference path="jquery-1.10.2.js" />
/// <reference path="google-maps-3-vs-1-0.js" />
var map;
var startMapOptions = new google.maps.MapOptions;
var startCenterLocation = new google.maps.LatLng(32.912229, -88.692627);
var startZoomLevel = 7;
var startMapTypeId = google.maps.MapTypeId.ROADMAP;
I'm trying to get this working with just some basic jQuery to load the map into a specific element, rather than using Google's tutorial code of google.maps.event.addDomListener(window, 'load', initialize);
What is it I am missing? My jQuery knowledge is limited, but I thought I at least knew how to do selectors and have script run when the page was ready with $(function() {})'
Or is my mistake in thinking that a map can be initialized other than the above mentioned way with addDomListener?