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.
|
|
|
|
|
![]() |
||
using xml in javascript
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
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); } } } |
|
|
![]() |
| Tags |
| using, xml, javascript |
| Thread Tools | |
|
|
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 |