jQuery(function($) { var map = new google.maps.Map(document.getElementById("map_canvas"), { center: new google.maps.LatLng(36.180774, -86.735863), zoom: 11, mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); $.get("http://locator.aids.gov/data?zip=37206", function(data) { $('p').remove(); $('body').append('<h2>' + data.title + '</h2>'); $.each(data.services, function() { $('body').append('<h2>' + this.title + '</h2>'); $.each(this.providers, function() { var entry = [ '<p>', '<strong>' + this.title + '</strong><br/>', this.streetAddress + '<br/>', this.locality + ', ', this.region + ' ', this.postalCode, '</p>']; var marker = new google.maps.Marker({ position: new google.maps.LatLng(this.point.lat, this.point.long), map: map, title: this.title, animation: google.maps.Animation.DROP }); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(entry.join("")); infowindow.open(map, marker); }); }); }); }, 'jsonp'); });
<p>Loading...</p> <div id="map_canvas" style="width:100%; height:100%"/>