Hi there, part of a site I'm developing uses input from a flash interface to update a google map (view at www.thelokator.com) However, even though the map is displaying, no user information (ie. markers, bubbles) is forming when the "Update Map" button is pressed.
The data is sent to a php script (generateXMLfromSQL.php), then the appropriate records are extracted from the database using a mysql statement, which ends up in some XML. You can view an example of how the XML looks by entering this URL into your browser: http://www.thelokator.com/generateXMLfromSQL.php?lat=-37.814251&lng=144.982123&distance=8000&kmsActive=1 So since the XML is being formed correctly, I'm thinking my problem lies somewhere with the marker deployment javascript, yes? If someone could take a look at the code below, I would be most appreciative. Unfortunately Javascript isn't my strong suit - although I'm slowly learning. Cheers, Peter <script language="JavaScript" type="text/JavaScript"> //<![CDATA[ function load() { // Check to see if this browser can run the Google API if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.addControl(new GScaleControl()); map.setCenter(new GLatLng(-25.274398, 133.775136), 4); } // display a warning if the browser was not compatible else { alert("Sorry, the Google Maps API is not compatible with this browser"); } } // activated by Flash console when button is pressed function searchLocations() { var searchUrl = 'generateXMLfromSQL.php'; GDownloadUrl(searchUrl, function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); map.clearOverlays(); var bounds = new GLatLngBounds(); for (var i = 0; i < markers.length; i++) { var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var user = markers[i].getAttribute("user"); var date = markers[i].getAttribute("date"); var time = markers[i].getAttribute("time"); var type = markers[i].getAttribute("type"); var title = markers[i].getAttribute("title"); var message = markers[i].getAttribute("message"); var timeTag = markers[i].getAttribute("postid"); var locationTag = markers[i].getAttribute("image"); var marker = createMarker(point, user, date, time, type, title, message, postid, image); map.addOverlay(marker); bounds.extend(point); } map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)); }); } function createMarker(point, user, date, time, type, title, message, postid, image) { marker = new GMarker(point); GEvent.addListener(marker, "click", function() { var html = "<div class=\"bubble\">" + "<div class=\"content\">" + "<table width='100%' border='0' cellspacing='0' cellpadding='0'>" + "<tr><td width='100%' align='left' valign='top'>" + "<div class=\"firstRow\"><strong>User: <div class=\"user \">" + user + "</div></strong></div>" + "<div class=\"rows\"><strong>Date: </strong>" + date + "</ div>" + "<div class=\"rows\"><strong>Time: </strong>" + time + "</ div>" + "<div class=\"rows\"><strong>Type: </strong>" + type + "</ div></div></td>" + "<td align='right' valign='top'>" + "<div class=\"image\"><img src='" + image + "' alt='User Image' width='60px' height='60px'/></div></td></tr>" + "<tr><td colspan='2' align='left' valign='bottom'><div class=\"link\">" + "<div class=\"envelope\"><a href='account_send.php?user=" + user + "'><img src='images/envelope.gif' alt='Message Me' width='16px' height='10px'/></a></div>" + "<a href='favourites.php?post=" + postid + "'><img src='images/heart.png' alt='Add to Favourites' width='13px' height='11px'/></a></div>" + "<div class=\"title\"><strong>" + title + "</strong></ div>" + "<div class=\"message\">" + message + "</div></td></tr></ table></div></div>"; marker.openInfoWindow(html); }); return marker; } //]]> </script></head> <body onload="load()" onunload="GUnload()"> ............... <!-- the map will be displayed here --> <div id="map" style="width: 597px; height: 400px"> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
