By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,561 Members | 3,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,561 IT Pros & Developers. It's quick & easy.

internet explorer does actually be refreshing the data after Ajax call

P: 82
I'm using AJAX on my website, but internet explorer does not seem to actually be refreshing the data I retrieve via AJAX when I refresh the page. For example, I have a button that when pressed uses an XMLHttpRequest to go read some data from a database then returns it to the browser for display. It looks like:

Press button
XMLHttpRequest gets data from db
XMLHttpRequest renders returned data in client browser

I can update the records in the database, ask the page to retrieve data but it doesn't seem to 'see' the new records unless I close the browser, and open a new instance. Then it picks up the changes.

Also if I go into the IE settings and choose 'Check for newer versions of stored pages: Every visit to the page' it works perfectly.

I can't rely on users to have chosen that setting though, so what can I do to get around this behaviour?
Apr 29 '08 #1
Share this Question
Share on Google+
7 Replies


gits
Expert Mod 5K+
P: 5,333
i have one doubt about your question, that you could clarify i think: why do you refresh the page when you use ajax? the ajax call itself should retrieve the data and updates the widget where the data are to be displayed. even when you need to refresh the page ... then just trigger the ajax call to read the data in the page's onload to init the widget ...

kind regards
Apr 29 '08 #2

P: 82
i have one doubt about your question, that you could clarify i think: why do you refresh the page when you use ajax? the ajax call itself should retrieve the data and updates the widget where the data are to be displayed. even when you need to refresh the page ... then just trigger the ajax call to read the data in the page's onload to init the widget ...

kind regards
Thanks Gits,

I don't refresh the all page just a portion of the page.
The scenario is as following:
1) I show a list of reviews summary in a div using Ajax call
2) In the same div if the user choose to add review I open the add review form
3) The new review is addded to the database using Ajax call after user choose add.
3) I make again an Ajax call to refresh the div with the updated lists of reviews.

But when I do that, the div does't refresh. Only after I make the changes in the IE browser setting the div refresh.

I think know the process is clear.You can try it yourself.
Apr 29 '08 #3

gits
Expert Mod 5K+
P: 5,333
in this case there is something wromg with the 'flow' ... could you post the code you use? for the add-operation and the followup read-operation? note that the read has to wait for the add so it has to be started in the onreadystatechange of your add-operation ... ?

kind regards
Apr 29 '08 #4

P: 82
This is what I do exactly, so actualy what I want to know how can I tell the browser not to load what is currently in its cache but to load the newer version of the storage page. look at internet explorer -> internet options -> temporary internet files -> settings -> check for the newer versions of the storged pages, throgh a javascript. I believe i need to clear the browser cache
Apr 29 '08 #5

gits
Expert Mod 5K+
P: 5,333
just add a unique dummy paramater to the query string:

Expand|Select|Wrap|Line Numbers
  1. query_string + '&d=' + (+ new Date);
kind regards
Apr 29 '08 #6

P: 82
Thanks gits for the workaround, it works!!!
Apr 29 '08 #7

gits
Expert Mod 5K+
P: 5,333
no problem :) ... post back to the forum anytime you have more questions ...

kind regards
Apr 29 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.