Hey everyone, I've got a Google Map on a website that I've been making. Here is a link to it: http://www.eatanddrinkonline.com/Map . It's got a search function that grabs locations out of a database and dynamically creates the XML that the Google Map will use. It's been working fine for weeks now and today I went online and it just wasn't working. I've gone back and reversed any changes I've made to the site today, but still nothing. I've added multiple alert statements to try to diagnose the problem, and I've just been able to figure out that it stops working at the line with the GDownloadURL statement. I've been working with the maps for a while and I've never had anything just stop working on me, and I've never had a problem with that statement. I'm hoping someone out there can spot this problem.
If you're interested, here's a link to the dynamically created XML file: http://www.eatanddrinkonline.com/read.php . Here is the code for the map in case it helps out right here. Let me know if there is anything else or more info I can provide, and thank you. ------------------------------------------------------------------------------------------ <script src="http://maps.google.com/maps? file=api&v=2&key=ABQIAAAASWrqkYdAu57vjS2g_sQm8xQzImkI_mzd9kVcRgSmzZLkdaMyjxTEipeHEmrekFD0J_nP3t0LkHefEQ" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ var map; var geocoder; function load() { if (GBrowserIsCompatible()) { geocoder = new GClientGeocoder(); map = new GMap2(document.getElementById('map')); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(40, -100), 4); } } function searchLocations() { var address = '<?php if(isset($_POST['zip'])){echo "$_POST[zip], NY";}else if (isset($_GET['zip'])){echo "$_GET[zip], NY";}else{echo 14607;} ?>'; var defaultAddress = '14607'; var defaultLatLng; geocoder.getLatLng(defaultAddress, function(latlng){defaultLatLng = latlng;}); geocoder.getLatLng(address, function(latlng) { if (!latlng) { searchLocationsNear(defaultLatLng); } else { searchLocationsNear(latlng); } }); } function searchLocationsNear(center) { <?php //here we must get all the possible values that could be passed through and make javascript variables for them //so that they can be passed through to read.php in the ajax call echo isset($_REQUEST['style_ID']) ? "var style_ID = '&style_ID= $_REQUEST[style_ID]'; \n" : "var style_ID = ''; \n"; echo isset($_REQUEST['area_ID']) ? "var area_ID = '&area_ID=$_REQUEST [area_ID]'; \n" : "var area_ID = ''; \n"; echo isset($_REQUEST['cuisine_ID']) ? "var cuisine_ID = '&cuisine_ID= $_REQUEST[cuisine_ID]'; \n" : "var cuisine_ID = ''; \n"; ?> // --- check to see if the variables have been left blank, and if they have use the values from the drop downs if(style_ID == ''){ style_ID = '&style_ID=' + document.getElementById('style_ID').value; } if(area_ID == ''){ area_ID = '&area_ID=' + document.getElementById('area_ID').value; } if(cuisine_ID == ''){ cuisine_ID = '&cuisine_ID=' + document.getElementById ('cuisine_ID').value; } var searchUrl = 'http://www.eatanddrinkonline.com/read.php?search=1' + style_ID + area_ID + cuisine_ID; alert(searchUrl); alert('right after searchurl'); GDownloadUrl(searchUrl, function(data) { alert('function of data'); var xml = GXml.parse(data); alert('markers found'); var markers = xml.documentElement.getElementsByTagName('marker'); alert('markers found'); map.clearOverlays(); alert('overlays cleared'); var sidebar = document.getElementById('sidebar'); sidebar.innerHTML = ''; if (markers.length == 0) { sidebar.innerHTML = 'No results found.'; map.setCenter(new GLatLng(40, -100), 4); return; } var bounds = new GLatLngBounds(); for (var i = 0; i < markers.length; i++) { alert('looping through markers'); var name = markers[i].getAttribute('advertiser_name'); //only create a link to the course page if it's chosen to be visible if(markers[i].getAttribute('visible') == 1){ var hyperlink = '<a href="/AdvertiserInfo/?advertiser_ID=' + markers[i].getAttribute('advertiser_ID') + '">' + name + '</a>'; } else { var hyperlink = name; } var address = markers[i].getAttribute('address'); var city = markers[i].getAttribute('city'); var state = markers[i].getAttribute('state'); var zip = markers[i].getAttribute('zip'); var phone = markers[i].getAttribute('phone'); var point = new GLatLng(parseFloat(markers[i].getAttribute ('lat')), parseFloat(markers[i].getAttribute('lng'))); //only make an image tag and link for a logo if it is not empty if(markers[i].getAttribute('logo') != ''){ if(markers[i].getAttribute('visible') == 1){ var logo = '<a href="/AdvertiserInfo/?advertiser_ID=' + markers [i].getAttribute('advertiser_ID') + '"><img src="' + markers [i].getAttribute('logo') + '" alt="' + markers[i].getAttribute ('advertiser_name') + ' Logo" /></a>'; } else { var logo = '<img src="' + markers[i].getAttribute('logo') + '" alt="' + markers[i].getAttribute('advertiser_name') + ' Logo"/>'; } } else { var logo = ''; } var daddr = address + ' ' + city + ', ' + state + ' ' + zip; var directions = '<form name="directions' + i + '" action="http:// maps.google.com/maps" method="get" target="_blank"><input type="hidden" name="daddr" value="' + daddr + '">Get directions from<br> <input type="text" name="saddr"><input type="submit" value="Go"></form><br />'; var marker = createMarker(point, hyperlink, address, city, state, zip, phone, logo, directions); map.addOverlay(marker); var sidebarEntry = createSidebarEntry(marker, name); sidebar.appendChild(sidebarEntry); bounds.extend(point); } map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel (bounds)); }); } function createMarker(point, hyperlink, address, city, state, zip, phone, logo, directions) { alert('creating marker'); var marker = new GMarker(point); var html = '<div style="float:left"><strong>' + hyperlink + '</ strong><br/>' + address + '<br>' + city + ', ' + state + ' ' + zip + '<br>' + phone + '<br>' + directions + '</div><div style="float:left; padding:10px">' + logo + '</div>'; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } function createSidebarEntry(marker, name) { alert('creating sidebar'); var div = document.createElement('div'); var html = '<b>' + name + '</b><br/>'; div.innerHTML = html; div.style.cursor = 'pointer'; div.style.marginBottom = '5px'; GEvent.addDomListener(div, 'click', function() { GEvent.trigger(marker, 'click'); }); GEvent.addDomListener(div, 'mouseover', function() { div.style.backgroundColor = '#eee'; }); GEvent.addDomListener(div, 'mouseout', function() { div.style.backgroundColor = '#fff'; }); return div; } //]]> </script> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
