Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-30-2006, 05:09 PM   PM User | #1
angst
Senior Coder

 
angst's Avatar
 
Join Date: Apr 2004
Location: Toronto, Ontario
Posts: 2,112
Thanks: 15
Thanked 122 Times in 122 Posts
angst is on a distinguished road
stop ajax caching?

hello,
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!
-Ken
angst is offline   Reply With Quote
Old 10-30-2006, 06:05 PM   PM User | #2
homerUK
Regular Coder

 
Join Date: Nov 2002
Location: Manchester, UK
Posts: 533
Thanks: 4
Thanked 1 Time in 1 Post
homerUK is an unknown quantity at this point
I've not experienced caching with ajax - what method are you using to submit/retrieve the data?
__________________
www.mattfacer.com
homerUK is offline   Reply With Quote
Old 10-30-2006, 06:07 PM   PM User | #3
angst
Senior Coder

 
angst's Avatar
 
Join Date: Apr 2004
Location: Toronto, Ontario
Posts: 2,112
Thanks: 15
Thanked 122 Times in 122 Posts
angst is on a distinguished road
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 %>

thanks!
-Ken
angst is offline   Reply With Quote
Old 10-30-2006, 06:10 PM   PM User | #4
homerUK
Regular Coder

 
Join Date: Nov 2002
Location: Manchester, UK
Posts: 533
Thanks: 4
Thanked 1 Time in 1 Post
homerUK is an unknown quantity at this point
aah cool - glad it's sorted!!
__________________
www.mattfacer.com
homerUK is offline   Reply With Quote
Old 10-30-2006, 08:43 PM   PM User | #5
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
You can do this too:

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

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 03:12 PM.


Advertisement
Log in to turn off these ads.