views:

312

answers:

3

Well I have a very rough version of gomoku working now. I'm using Jquery, Php and mysql database.

When a user clicks on a board square a piece is placed. An ajax refresh determines if turn count has been incremented and updates the board's html if necessary.

The problem is that Internet Explore (6,8,&probably 7) caches the page on the first visit. Even if the page is refresh manually the cached content will remain.

I tried using

 <META HTTP-EQUIV="cache-Control" CONTENT="no-cache">
 <META HTTP-EQUIV="Pragma" CONTENT="no-cache">

on the html page with no luck. Only way to get an update is to delete the files though the tools.

I hope this is enough information. If not I'll try to answer questions as best as possible.


Update 3 I got it working I used the .ajaxSetup Thanks phoenix, tim, and everyone else.

+6  A: 

Each time append a random number to the end of the AJAX request to make the request URL to be different.

The random bit of information you will submit to the server can be a number (larger the better), random string, or a timestamp.

var url = “http://domain?myParameters=values&amp;pseudoParam= "+new Date().getTime();

Edit:

If you want to set up global settings for AJAX requests then you can use

jQuery.ajaxSetup( options )

and to set cache off

jQuery.ajaxSetup({ cache: false });

For each request you can use

jQuery.ajax( options )

and set the cache to false as pointed out by @Tim

rahul
I was about to say that +1
Tim Santeford
+1 for this nice lil hack
Rakesh Juyal
do i put the ajaxSetup function in my script anywhere?
Bolt_Head
nm I got it working thanks.
Bolt_Head
+2  A: 

you could try "cache: false"

$.ajax({url: "url", success: myCallback, cache: false});
Tim Santeford
A: 

It is a default IE behaviour. I avoided that by adding random number in the request.

Vladimir Kocjancic