Hi,
I am calling an
xml using javasript.I am able to call the
xml but the
xml is getting cached on client machine forever.Even though if any changes done in the
xml file still the cached
xml is used from the client machine.Since the
http request is used for calling a
xml hence ideally the cached
xml is used from the client machine untill its contents are changed.
Pls find the code I have used...
pls help before my boss kills me
// to load the
xml
function loadreq(url)
{
// branch for native XMLHttpRequest object
if (window.XMLHttpRequest) {
req_Head = new XMLHttpRequest();
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.send(null);
req.open("GET", url,true);
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
req_Head = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req_Head.open("HEAD", url,true);
req.open("GET", url, true);
req.send();
}
}
}
//to read the
xml
function processReqChange()
{
if (req.readyState == 4) {
if (req.status == 200) {
var Gujarati_News ;
var response = req.responseXML.documentElement;
var news=response.getElementsByTagName("news")
i= 0
var news_texts ;
news_texts = ""
for(var i=0; i<= news.length-1; i++){
// create a string
news_texts = news_texts + "<a href='../quressan/news.
asp?newsid=" + news[i].getAttribute("links") +"&typeid="+news[i].getAttribute("typeid")+"'><font size='2' color='#1c355d' face='arial'><b>*" + response.getElementsByTagName("news")[i].firstChild.nodeValue+ ">> </b></font></a>"
if(news[i].getAttribute("dt_tm")!=""){
dt_tm = news[i].getAttribute("dt_tm")
news_texts = news_texts + "<br><font size='1' color='#1c355d' face='arial'>(" + dt_tm + ")</font>"
}
news_texts = news_texts + "<br><br>"
}
news_text.innerHTML = news_texts ;
} else {
alert("There was a problem retrieving the
XML data:\n" + req.statusText);
}
}
}