Posted by mich dobelman on 08/28/06 06:58
What's the common way to integrate php and google map api?
I tried to create the getShop.php script which access the db and fetch
the list of shops with lat and lon information in xml document. But without
access? I thought this is not the common way to call the php script from
javascript?
any advice appreciated.
var dom = new ActiveXObject("Msxml2.DOMDocument");
dom.async = false;
alert( "before call");
dom.load("getShops.php?x1=" + bounds.minX + "&y1=" + bounds.minY + "&x2="
+ bounds.maxX + "&y2=" + bounds.maxY);
alert( dom.xml );
alert( "after call");
var xml = GXml.parse(dom.xml);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var point = new GLatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng"))
);
map.addOverlay(new GMarker(point));
}
[Back to original message]
|