My set-up;
index.asp Displays a blank map, and a form for collecting new location
data.
This new data is passed to tracking.asp which updates the database,
writes out a new data.xml file (overwriting the previous server copy),
then redirects to results.html which displays all the results by
reading the xml file using line 9 of this template code
function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(51.87543367554868,
-0.7657934725284576), 4);
map.removeMapType(G_HYBRID_MAP);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setMapType(G_MAP_TYPE);
GDownloadUrl("data.xml", function(data) {
var xml = GXml.parse(data);
var markers =
xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var latlng = new
GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var mtitle = markers[i].getAttribute("title");
opts=
{
"title": mtitle
}
map.addOverlay(new GMarker(latlng, opts));
}
});
}
}
I think data.xml is being cached as I do not always see the results in
IE. If you you submit a new entry and result.html is not showing that
entry, then put data.xml in the URL to view it in the browser, the
latest result isn't at the end of the list. Push Ctrl-F5 (refresh),
and it shows up at the end, and going back to result.html will then
show it on the map.
How do I create an auto Ctrl-F5 on data.xml whenever results.html is
loaded or refreshed?
http://www/paulscorner.info/index.asp if you want to look at the code
online (NB it will always work first time ~ try entering a new
location again and it probably will not show the 2nd one)
Regards Paul