This little trick works. Thank you so much.

The AJAX function (Dreamweaver CS3 Spry) that I use supposed to have a boolean argument that I can set True/False to Cache/Not Cache the data. For some reasons that didn't work.

Thanks again.

MC


At 10:36 AM 12/6/2007, you wrote:
Hi MC, Well, this is an entirely different problem, trying to prevent caching of a static file. I assumed you were talking about a TAF. My mistake. You'll have to use javascript during your AJAX call to make the url unique. So create a function like: function UrlUnique(p_url){ var v_randomNumber = Math.random(); var v_uniqifier = 'unique=' + v_randomNumber.toString().substr(2); if(p_url.indexOf('?') > 0){ p_url += '&' + v_uniqifier; }else{ p_url += '?' + v_uniqifier; } return p_url; } Than take whatever variable you are using for your XML file, and append the random argument like so: var myXML_url = 'staticFile.xml'; myXML_url = UrlUnique(myXML_url); (pass variable to your AJAX function call) Then you should end up with a unique url address for the file on every call, and it'll look something like staticFile.xml?unique=98462849311 Eventhough the file is static, passing it an argument is harmless because the file will just ignore it, but your browser will fetch a fresh file every time. Hope that helps. Scott, On Thursday, December 6, 2007 1:19pm, MC Tay <[EMAIL PROTECTED]> said: > Thanks Scott. This works well on getting data from WiTango. > > I'm also using an AJAX approach (within an html file) to read an XML > file in notepad. In the html file, I have the header setup as follows: > > <head> > <meta http-equiv="Content-Type" content="text/xml; charset=utf-8" /> > <meta name="Pragma" value="no-cache"> > <meta name="Cache-control" value="no-cache, max-age=0, > must-revalidate, proxy-revalidate"> > <meta name="Expires" value="-1"> > </head> > > But the XML data is still cached. Any idea where did I do wrong? > > Thanks! > > MC > > At 09:40 AM 12/6/2007, you wrote: >>Hi MC, See the following message from the Archive. The code is for >>newer versions of tango, so if you have to work with the older >>version, replace <@HTTPSTATUSCODE> <@HTTPREASONPHRASE> with the text >>200 OK. >>http://www.mail-archive.com/[email protected]/msg10780.h tml >>You could also try adding a random argument value to uniquify the >>URL. Caches are largely based on the entire URL of the content >>(regardless of it's HTML or XML, etc...), so if even a single >>character in the URL has changed the cache is ignored. Example: >>/some.taf?random=<@RANDOM> Or you could use the javascript >>Math.random() function. Hope this helps. Scott, On Thursday, >>December 6, 2007 4:37am, MC Tay <[EMAIL PROTECTED]> said: > Hi: > > >>Does anyone know how to prevent XML data from caching? Every time >>I > change an XML file, I keep getting old data even the browser is >>refreshed. > > Thanks! > > MC > > >>____________________________________________________________ ____________ >> > TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf > > >>_________________ _______________________________________________________ >>TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf > > ________________________________________________________________________ > TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf > >
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to