View Full Version : stop ajax caching?

10-30-2006, 05:09 PM
I'm not sure if this is the right forum to post this in.

but I'm wondering how i can stop ajax from cashing results,, atleast while testing, i'm finding that i often need to close the browser and re-open it to get an updated result, or if there was an error, I will continue to get the same error even if it was fixed untill i start a new browser session.

thanks in advance for your time!

10-30-2006, 06:05 PM
I've not experienced caching with ajax - what method are you using to submit/retrieve the data?

10-30-2006, 06:07 PM
I'm using this:

function GetXmlHttpObject(){
var objXMLHttp=null
if (window.XMLHttpRequest){
objXMLHttp=new XMLHttpRequest()
}else if (window.ActiveXObject) {
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
return objXMLHttp

but I've just solved it by using this ( in .asp )

<% Response.CacheControl = "no-cache" %>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>


10-30-2006, 06:10 PM
aah cool - glad it's sorted!! ;)

10-30-2006, 08:43 PM
You can do this too:

xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum