K
kwilder
This works, but it doesn't load the latest version of the xml if it was
just modified without closing and reopening the browser.
Here's the scenario:
I have an xml doc called results.xml. It can contain lots of data.
<Results>
<Data>Stuff</Data>
<Data>More stuff</Data>
</Results>
My ASP application can add to the data during the year. At the end of
the year I want to reset the xml.
I run a script that can make a copy of the file from results.xml to
results_[yyyymmdd].xml as a backup and save a new results.xml file as
the following with a backup date attribute:
<Results BUDate="20051124"></Results>
So far this all works fine, but here's where the problem occurs. I've
set a Backup date attribute on the off chance I want to restore that
lastest file.
I have a checkbox that will toggle between enabled and disabled
depending on whether the results.xml file has an attribute "BUDate".
If I try to restore the backup immediately, during the same session it
returns the results.xml file as it was before it was backed up. In
other words, it has all the data!
In order to get it to work correctly, I have to log off, close the
browser (IE) and re-open the browser.
Is there any way to make it retrieve that latest xml version without
closing the browser?
Many thanks,
King Wilder
Here's my javascript code:
var response = null;
// global flag
var isIE = false;
// global request and XML document objects
var req;
function loadXMLDoc(url, GoAsync) {
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, GoAsync);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
isIE = true;
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, GoAsync);
req.send();
}
}
}
// handle onreadystatechange event of req object
function processReqChange() {
// only if req shows "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
response = req.responseXML;
} else {
alert("There was a problem retrieving the XML data:\n" +
req.statusText);
}
}
}
just modified without closing and reopening the browser.
Here's the scenario:
I have an xml doc called results.xml. It can contain lots of data.
<Results>
<Data>Stuff</Data>
<Data>More stuff</Data>
</Results>
My ASP application can add to the data during the year. At the end of
the year I want to reset the xml.
I run a script that can make a copy of the file from results.xml to
results_[yyyymmdd].xml as a backup and save a new results.xml file as
the following with a backup date attribute:
<Results BUDate="20051124"></Results>
So far this all works fine, but here's where the problem occurs. I've
set a Backup date attribute on the off chance I want to restore that
lastest file.
I have a checkbox that will toggle between enabled and disabled
depending on whether the results.xml file has an attribute "BUDate".
If I try to restore the backup immediately, during the same session it
returns the results.xml file as it was before it was backed up. In
other words, it has all the data!
In order to get it to work correctly, I have to log off, close the
browser (IE) and re-open the browser.
Is there any way to make it retrieve that latest xml version without
closing the browser?
Many thanks,
King Wilder
Here's my javascript code:
var response = null;
// global flag
var isIE = false;
// global request and XML document objects
var req;
function loadXMLDoc(url, GoAsync) {
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, GoAsync);
req.send(null);
// branch for IE/Windows ActiveX version
} else if (window.ActiveXObject) {
isIE = true;
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, GoAsync);
req.send();
}
}
}
// handle onreadystatechange event of req object
function processReqChange() {
// only if req shows "loaded"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
response = req.responseXML;
} else {
alert("There was a problem retrieving the XML data:\n" +
req.statusText);
}
}
}