using xml in javascript

This is a discussion on "using xml in javascript" within the JavaScript Forum section. This forum, and the thread "using xml in javascript are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jul 25th, 2006, 07:36
New Member
Join Date: Jul 2006
Location: mumbai
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
using xml in javascript

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);
}
}
}
Reply With Quote

Reply

Tags
using, xml, javascript

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
php and javascript yvettesio JavaScript Forum 8 Mar 14th, 2007 23:18
Javascript Help Daniel JavaScript Forum 5 Jan 4th, 2007 22:00
JavaScript cbrams9 JavaScript Forum 1 Sep 20th, 2006 17:35
Can someone help me with this javascript Galaxyblue JavaScript Forum 2 Mar 11th, 2004 12:18
what does \\ mean in javascript jenjen1018 JavaScript Forum 5 Jan 6th, 2004 17:05


All times are GMT. The time now is 19:40.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43