Link to home
Start Free TrialLog in
Avatar of Rob Gaudet
Rob GaudetFlag for United States of America

asked on

How to Check Google Maps API Return Status?

Where would I check the return status from Google in this code?

	<script type="text/javascript">

		//google.maps.event.addDomListener(window, 'load', initialize);

		if(navigator.geolocation)
		{
			navigator.geolocation.getCurrentPosition(initialize);
		}
		else
		{
			alert("Your current location cannot be determined.");
		}

		function initialize(position)
		{
			var lat = '32.516053'; //position.coords.latitude
			var lon = '-93.744957'; //position.coords.longitude
			var myLatlng = new google.maps.LatLng(lat, lon);

			var mapOptions = {zoom: 14, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP}
			
			alert(position.coords.latitude);
			var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);

			var image = '/Images/marker.png';
			var memberImage = '/Images/membermarker.png';

			var locations = <%=locations%>

			var infowindow = new google.maps.InfoWindow();
			var marker, i;

			marker = new google.maps.Marker({
					position: myLatlng,
					map: map,
					icon: memberImage
				});

			google.maps.event.addListener(marker, 'click', function() {
				infowindow.setContent("My Current Location");
				infowindow.open(map, marker);
			});

			for (i = 0; i < locations.length; i++)
			{
				marker = new google.maps.Marker(
				{
					position: new google.maps.LatLng(locations[i][1], locations[i][2]),
					map: map,
					icon: image
				});

				google.maps.event.addListener(marker, 'click', (function (marker, i)
				{
					return function ()
					{
						infowindow.setContent(locations[i][0]);
						infowindow.open(map, marker);
					}
				})(marker, i));
			}
		}

Open in new window

Avatar of Rob Gaudet
Rob Gaudet
Flag of United States of America image

ASKER

I'm having a problem getting the Google maps api to load, below are the locations. I'm not sure exactly how to debug what the problem is??


var locations = [
['<div style="text-align:left; padding:10px;"><h3>Starbucks Coffee</h3><b>asdf</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_f485efbe-711a-478f-bd91-e580a9cf0d49.png"></div>', 32.4541899, -93.747131, 1],
['<div style="text-align:left; padding:10px;"><h3>Starbucks Coffee</h3><b>Test</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_5549bbe9-7e02-47bf-ad11-d78bf478dc2f.gif"></div>', 32.4541899, -93.747131, 2],
['<div style="text-align:left; padding:10px;"><h3>NA</h3><b>adf</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_5771deb8-b80a-4eff-9cb7-1051c43cef00.jpg"></div>', 32.588626, -93.697975, 3],
['<div style="text-align:left; padding:10px;"><h3>NA</h3><b>adsf</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_7062d97b-47b7-46f0-9665-ac0e391dfd6c.jpg"></div>', 32.588626, -93.697975, 4],
['<div style="text-align:left; padding:10px;"><h3>NA</h3><b>Chamber Image</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_65ffeab1-dcdb-4292-9df0-d2f2e83b8195.jpg"></div>', 32.588626, -93.697975, 5],
['<div style="text-align:left; padding:10px;"><h3>NA</h3><b>df</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_6bc52518-b208-459c-aa42-776348c2a8bc.jpg"></div>', 32.588626, -93.697975, 6],
['<div style="text-align:left; padding:10px;"><h3>Newks</h3><b>Bowling Pin</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_fc0173f3-595f-4965-8d1e-053c65f1ecdf.jpg"></div>', 32.588661, -93.6980449, 7],
['<div style="text-align:left; padding:10px;"><h3>Newks</h3><b>Flannel Shirt</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_c6cde51b-1dc0-4420-b9fd-7bcdef9f5039.jpg"></div>', 32.588661, -93.6980449, 8],
['<div style="text-align:left; padding:10px;"><h3>Newks</h3><b>News Sandwhich</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_3c080975-8d2b-433b-a946-588016a908ec.jpg"></div>', 32.588661, -93.6980449, 9],
['<div style="text-align:left; padding:10px;"><h3>Newks</h3><b>Patrick Holding Sign Photograp</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_651bfc5d-0019-4d73-a1fc-3d9ade72a705.jpg"></div>', 32.588661, -93.6980449, 10],
['<div style="text-align:left; padding:10px;"><h3>Newks</h3><b>tie</b><br><img style="width:150px; margin-top:10px;" src="http://localhost:51081/ProductImages/thumbx215_5436faf5-85e8-4549-bd5f-6edad1dd8cd2.jpg"></div>', 32.588661, -93.6980449, 11]

];

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks leak, that helped.