472,146 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

internet explorer does actually be refreshing the data after Ajax call

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
7 2321
gits
5,390 Expert Mod 4TB
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
raknin
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
5,390 Expert Mod 4TB
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
raknin
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
5,390 Expert Mod 4TB
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
raknin
82
Thanks gits for the workaround, it works!!!
Apr 29 '08 #7
gits
5,390 Expert Mod 4TB
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.

Similar topics

1 post views Thread by Apu Nahasapeemapetilon | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.