internet explorer does actually be refreshing the data after Ajax call

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raknin
    New Member
    • Oct 2007
    • 82

    internet explorer does actually be refreshing the data after Ajax call

    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?
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    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

    Comment

    • raknin
      New Member
      • Oct 2007
      • 82

      #3
      Originally posted by gits
      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.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        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 onreadystatecha nge of your add-operation ... ?

        kind regards

        Comment

        • raknin
          New Member
          • Oct 2007
          • 82

          #5
          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

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            just add a unique dummy paramater to the query string:

            [CODE=javascript]query_string + '&d=' + (+ new Date);[/CODE]
            kind regards

            Comment

            • raknin
              New Member
              • Oct 2007
              • 82

              #7
              Thanks gits for the workaround, it works!!!

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5390

                #8
                no problem :) ... post back to the forum anytime you have more questions ...

                kind regards

                Comment

                Working...