This is my first stab at using XML/AJAX in conjunction with PHP and
Google Maps and I'm having problems getting "new google.maps.LatLng"
to get-an-attribute.
As background:
I use getPosition() to get the Latitude and Longitude of a marker
location and store this in a MySQL database, in the format (lat,long)
38.45768,-120.22345.
I've used this format for many map scripts, pulling data from MySQL
databases and php-echoing the output with no problems what so ever.
By running the php script that generates the XML I'm able to determine
that the XML is being generated "correctly".
What seems to be going awry is getting the LatLng to get it's
attribute.
Here is the code snippet with what I believe to be the offending code
spaced out by itself.
downloadUrl("genxml.php", function(data) {
var xml = data.responseXML;
var markers =
xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var point = new
google.maps.LatLng(markers[i].getAttribute("latlong"));
var html = "<b>" + name + "</b> <br/>" + address;
var marker = new google.maps.Marker({
map: map,
position: point,
});
bindInfoWindow(marker, map, infoWindow, html);
}
});
I've modified this code from one of the articles in the v3API.
When the original code.....
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
.... is used, and the genxml.php is pointed to a compatible
db,everything works fine.
Any assistance / point in the right direction would be greatly
appreciated!
Links to pages in question:
XML generator to verify good XML
http://maps.cerebrateaquarium.com/genxml.php
Map Generator with the offending script.
http://maps.cerebrateaquarium.com/map_v3.php
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.