0

Web programmer here - using AJAX (HTML, CSS, JavaScript, AJAX, PHP, MySQL), but for some reason Internet Explorer is acting up (surprise surprise).

AJAX is updating query results on the HTML page, via a PHP script that queries a MySQL Database.

Everything is working fine, except when I use Internet Explorer 8.0 .

There are several php scripts, which allow for the data to be ordered according to certain criteria, and for testing purposes I have attached the mktime field (current time, in the format HH:MM:SS) to the beginning of the results for each query. When I use IE, these times appear to remain constant, whereas with ALL other browsers these times are correct and display the current time.

I think the issue has something to do with caching or something along those lines anyway.

Any thoughts or suggestions welcome...

2
  • Nice work mate, Cant believe it was that simple! Commented Feb 12, 2010 at 12:36
  • I had an absolute headache with the same thing not too long ago so made a point of always remembering it! Commented Feb 12, 2010 at 12:38

4 Answers 4

2

Here is an article on the caching issue.

If your request is a GET change it to a POST, this will prevent the results being cached.

Sign up to request clarification or add additional context in comments.

1 Comment

Updated post with article link. Sorry about that!
1

GET requests are cached in IE; switch it to a POST request and it won't be cached anymore.

Comments

1

Instead of switching to POST, which can be ugly if you're not really using it to update or create content, you should append a random number to the query string, as in http://domain.com/ajax/some-request?r=123456. If this number is unique for every request you won't have caching problems.

Comments

0

What I have done is, I have kept the "GET" and added new dummy query parameter to the querystring as follows,

./BaseServlet?sname=3d_motor&calcdir=20110514&dummyParam=datetime

I set dummyParam a value of date object in the javascript so that every time the url is generated browser will treat it as a new url and fetch new (fresh) results.

var d = new Date();
url = url + '&dummyParam='+d.valueOf();

So instead of generating some random numbers this is easy way!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.