I have a script that produces XML from database queries based on some
parameters passed to it. I'm interested if GXmlHttp is the best way to
do this?
---------------
var request = GXmlHttp.create();
request.open('GET', '/library/server.php?'+getVars, true);
request.onreadystatechange = function() {
// Don't do anything else until the Ready State is good...
if (request.readyState == 4) {
var xmlDoc = GXml.parse(request.responseText);
var markers = xmlDoc.documentElement.getElementsByTagName
("marker");
//create each point from the list
for (var i = 0; i < markers.length; i++) {
// obtain the attribues of each marker
var lat = parseFloat(markers[i].getAttribute("lat"));
var lng = parseFloat(markers[i].getAttribute("lng"));
var point = new GLatLng(lat,lng);
var html = markers[i].getAttribute("html");
var cat = markers[i].getAttribute("cat");
var id = markers[i].getAttribute("id");
// GLog.writeUrl('VARS lat: '+lat+' Lng: '+lng+' id: '+id+'
cat:
'+cat);
var marker = createMarker(point,html,id,cat);
map.addOverlay(marker);
}
}
if (i<1) { document.getElementById("markercount").innerHTML = "Move
the map or zoom out for FREE offers!"; }
if (i==1) { document.getElementById("markercount").innerHTML = "There
is 1 FREE offer in this map view!"; }
if (i>1) { document.getElementById("markercount").innerHTML = "There
are "+i+" FREE offers in this map view!"; }
}
--
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.