AJAX html won't refresh after data update

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • javelin

    AJAX html won't refresh after data update

    I created a feature in a page where a DIV displays child records of
    the current record. From this same page, I can submit the insertion of
    a new child record. However, the while the previous child records
    displayed fine, the newly added ones don't - until I close down IE and
    restart it. I know, there's a setting in IE options which will force a
    refresh on each page load, instead of caching, but I can't access it
    from these computers (NT policy prohibits it, I guess). None of the
    end users can either, so that's not a solution. Anything I can do
    programmaticall y here?

    Thanks.

  • Robin

    #2
    Re: AJAX html won't refresh after data update

    javelin wrote:
    I created a feature in a page where a DIV displays child records of
    the current record. From this same page, I can submit the insertion of
    a new child record. However, the while the previous child records
    displayed fine, the newly added ones don't - until I close down IE and
    restart it. I know, there's a setting in IE options which will force a
    refresh on each page load, instead of caching, but I can't access it
    from these computers (NT policy prohibits it, I guess). None of the
    end users can either, so that's not a solution. Anything I can do
    programmaticall y here?
    Add a 'unique' variable to the query string of you ajax URI so that
    browser doesn't use the cached copy.

    i.e.
    obj.open('GET', 'ajax_call.php? recid='+recid+' &z='+
    new Date().getTime( ),true);


    HTH
    Robin

    Comment

    • Good Man

      #3
      Re: AJAX html won't refresh after data update

      javelin <google.1.jvmai l@spamgourmet.c omwrote in
      news:1191507760 .733314.137170@ 22g2000hsm.goog legroups.com:
      I created a feature in a page where a DIV displays child records of
      the current record. From this same page, I can submit the insertion of
      a new child record. However, the while the previous child records
      displayed fine, the newly added ones don't - until I close down IE and
      restart it. I know, there's a setting in IE options which will force a
      refresh on each page load, instead of caching, but I can't access it
      from these computers (NT policy prohibits it, I guess). None of the
      end users can either, so that's not a solution. Anything I can do
      programmaticall y here?
      Send an expired header with your data. Here's a straight lift from PHP
      code:

      //IE CACHES AJAX PAGES!!!
      header("Expires : Sun, 19 Nov 1978 05:00:00 GMT");
      header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
      header("Cache-Control: no-store, no-cache, must-revalidate");
      header("Cache-Control: post-check=0, pre-check=0", false);
      header("Pragma: no-cache");

      .... followed by the correct headers and data for the XML or whatever output
      you send back....


      Comment

      • cts1@spvision.com

        #4
        Re: AJAX html won't refresh after data update

        Dang, Robin! That actually works! Not used to getting such good help
        the first time around :D

        Thanks for the great idea.

        J

        On Oct 4, 9:52 am, Robin <a...@somewhere .comwrote:
        javelin wrote:
        I created a feature in a page where a DIV displays child records of
        the current record. From this same page, I can submit the insertion of
        a new child record. However, the while the previous child records
        displayed fine, the newly added ones don't - until I close down IE and
        restart it. I know, there's a setting in IE options which will force a
        refreshon each page load, instead of caching, but I can't access it
        from these computers (NT policy prohibits it, I guess). None of the
        end users can either, so that's not a solution. Anything I can do
        programmaticall y here?
        >
        Add a 'unique' variable to the query string of you ajax URI so that
        browser doesn't use the cached copy.
        >
        i.e.
        obj.open('GET', 'ajax_call.php? recid='+recid+' &z='+
        new Date().getTime( ),true);
        >
        HTH
        Robin

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: AJAX html won't refresh after data update

          cts1@spvision.c om wrote:
          On Oct 4, 9:52 am, Robin <a...@somewhere .comwrote:
          >Add a 'unique' variable to the query string of you ajax URI so that
          >browser doesn't use the cached copy.
          >>
          >i.e.
          >obj.open('GET' ,'ajax_call.php ?recid='+recid+ '&z='+
          > new Date().getTime( ),true);
          >
          Dang, Robin! That actually works! Not used to getting such good help
          the first time around :D
          >
          Thanks for the great idea.
          That idea is BAD because it fills the browser cache with garbage, and so
          eventually slows down access to other content. Unnecessarily.

          Please don't top-post: http://jibbering.com/faq/


          PointedEars
          --
          realism: HTML 4.01 Strict
          evangelism: XHTML 1.0 Strict
          madness: XHTML 1.1 as application/xhtml+xml
          -- Bjoern Hoehrmann

          Comment

          • cts1@spvision.com

            #6
            Re: AJAX html won't refresh after data update

            Dang, Robin! That actually works! Not used to getting such good help
            the first time around :D

            Thanks for the great idea.

            J

            On Oct 4, 9:52 am, Robin <a...@somewhere .comwrote:
            javelin wrote:
            I created a feature in a page where a DIV displays child records of
            the current record. From this same page, I can submit the insertion of
            a new child record. However, the while the previous child records
            displayed fine, the newly added ones don't - until I close down IE and
            restart it. I know, there's a setting in IE options which will force a
            refreshon each page load, instead of caching, but I can't access it
            from these computers (NT policy prohibits it, I guess). None of the
            end users can either, so that's not a solution. Anything I can do
            programmaticall y here?
            >
            Add a 'unique' variable to the query string of you ajax URI so that
            browser doesn't use the cached copy.
            >
            i.e.
            obj.open('GET', 'ajax_call.php? recid='+recid+' &z='+
            new Date().getTime( ),true);
            >
            HTH
            Robin

            Comment

            • Randy Webb

              #7
              Re: AJAX html won't refresh after data update

              Thomas 'PointedEars' Lahn said the following on 10/5/2007 2:00 PM:
              cts1@spvision.c om wrote:
              >On Oct 4, 9:52 am, Robin <a...@somewhere .comwrote:
              >>Add a 'unique' variable to the query string of you ajax URI so that
              >>browser doesn't use the cached copy.
              >>>
              >>i.e.
              >>obj.open('GET ','ajax_call.ph p?recid='+recid +'&z='+
              >> new Date().getTime( ),true);
              >Dang, Robin! That actually works! Not used to getting such good help
              >the first time around :D
              >>
              >Thanks for the great idea.
              >
              That idea is BAD because it fills the browser cache with garbage, and so
              eventually slows down access to other content. Unnecessarily.
              Pure nonsense.

              --
              Randy
              Chance Favors The Prepared Mind
              comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
              Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

              Comment

              • Thomas 'PointedEars' Lahn

                #8
                Re: AJAX html won't refresh after data update

                Randy Webb wrote:
                Thomas 'PointedEars' Lahn said the following on 10/5/2007 2:00 PM:
                >cts1@spvision.c om wrote:
                >>On Oct 4, 9:52 am, Robin <a...@somewhere .comwrote:
                >>>Add a 'unique' variable to the query string of you ajax URI so that
                >>>browser doesn't use the cached copy.
                >>>>
                >>>i.e.
                >>>obj.open('GE T','ajax_call.p hp?recid='+reci d+'&z='+
                >>> new Date().getTime( ),true);
                >>Dang, Robin! That actually works! Not used to getting such good help
                >>the first time around :D
                >>>
                >>Thanks for the great idea.
                >That idea is BAD because it fills the browser cache with garbage, and so
                >eventually slows down access to other content. Unnecessarily.
                >
                Pure nonsense.
                (sic!)

                It isn't nonsense, it's a fact. (Or have I overlooked your argument by any
                chance?)


                PointedEars
                --
                var bugRiddenCrashP ronePieceOfJunk = (
                navigator.userA gent.indexOf('M SIE 5') != -1
                && navigator.userA gent.indexOf('M ac') != -1
                ) // Plone, register_functi on.js:16

                Comment

                • Randy Webb

                  #9
                  Re: AJAX html won't refresh after data update

                  Thomas 'PointedEars' Lahn said the following on 10/5/2007 7:41 PM:
                  Randy Webb wrote:
                  >Thomas 'PointedEars' Lahn said the following on 10/5/2007 2:00 PM:
                  >>cts1@spvision.c om wrote:
                  >>>On Oct 4, 9:52 am, Robin <a...@somewhere .comwrote:
                  >>>>Add a 'unique' variable to the query string of you ajax URI so that
                  >>>>browser doesn't use the cached copy.
                  >>>>>
                  >>>>i.e.
                  >>>>obj.open('G ET','ajax_call. php?recid='+rec id+'&z='+
                  >>>> new Date().getTime( ),true);
                  >>>Dang, Robin! That actually works! Not used to getting such good help
                  >>>the first time around :D
                  >>>>
                  >>>Thanks for the great idea.
                  >>That idea is BAD because it fills the browser cache with garbage, and so
                  >>eventually slows down access to other content. Unnecessarily.
                  >Pure nonsense.
                  >
                  (sic!)
                  >
                  It isn't nonsense, it's a fact. (Or have I overlooked your argument by any
                  chance?)
                  You have overlooked the argument. There is a very good reason for using
                  a query string to force a reload from the server. And no, headers and
                  server settings won't satisfy the need.

                  --
                  Randy
                  Chance Favors The Prepared Mind
                  comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
                  Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

                  Comment

                  • Laurent vilday

                    #10
                    Re: AJAX html won't refresh after data update

                    Thomas 'PointedEars' Lahn a écrit :
                    Randy Webb wrote:
                    >Thomas 'PointedEars' Lahn said the following on 10/5/2007 2:00 PM:
                    >>cts1@spvision.c om wrote:
                    >>>On Oct 4, 9:52 am, Robin <a...@somewhere .comwrote:
                    >>>>Add a 'unique' variable to the query string of you ajax URI so that
                    >>>>browser doesn't use the cached copy.
                    >>>Dang, Robin! That actually works! Not used to getting such good help
                    >>>the first time around :D
                    >>>Thanks for the great idea.
                    >>That idea is BAD because it fills the browser cache with garbage, and so
                    >>eventually slows down access to other content. Unnecessarily.
                    >Pure nonsense.
                    (sic!)
                    >
                    It isn't nonsense, it's a fact.
                    sic !

                    It is well-known among competent Web developers that IE is suffering a
                    cache issue with XHR when the call method is "GET". And no headers will
                    do anything to it.

                    The only solution is to add a dummy unique variable to the querysting.

                    *That* is a fact among others !

                    --
                    laurent

                    Comment

                    • Thomas 'PointedEars' Lahn

                      #11
                      Re: AJAX html won't refresh after data update

                      Randy Webb wrote:
                      Thomas 'PointedEars' Lahn said the following on 10/5/2007 7:41 PM:
                      >Randy Webb wrote:
                      >>Thomas 'PointedEars' Lahn said the following on 10/5/2007 2:00 PM:
                      >>>cts1@spvision.c om wrote:
                      >>>>On Oct 4, 9:52 am, Robin <a...@somewhere .comwrote:
                      >>>>>Add a 'unique' variable to the query string of you ajax URI so
                      >>>>>that browser doesn't use the cached copy.
                      >>>>>>
                      >>>>>i.e. obj.open('GET', 'ajax_call.php? recid='+recid+' &z='+ new
                      >>>>>Date().get Time(),true);
                      >>>>Dang, Robin! That actually works! Not used to getting such good
                      >>>>help the first time around :D
                      >>>>>
                      >>>>Thanks for the great idea.
                      >>>That idea is BAD because it fills the browser cache with garbage,
                      >>>and so eventually slows down access to other content.
                      >>>Unnecessaril y.
                      >>Pure nonsense.
                      >(sic!)
                      >>
                      >It isn't nonsense, it's a fact. (Or have I overlooked your argument by
                      >any chance?)
                      >
                      You have overlooked the argument.
                      There was no argument. There was a statement.
                      There is a very good reason for using a query string to force a reload
                      from the server. And no, headers and server settings won't satisfy the
                      need.
                      You have not stated the reason; that is no argument, it is a statement.


                      PointedEars
                      --
                      Prototype.js was written by people who don't know javascript for people
                      who don't know javascript. People who don't know javascript are not
                      the best source of advice on designing systems that use javascript.
                      -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

                      Comment

                      • Thomas 'PointedEars' Lahn

                        #12
                        Re: AJAX html won't refresh after data update

                        Laurent vilday wrote:
                        Thomas 'PointedEars' Lahn a écrit :
                        >Randy Webb wrote:
                        >>Thomas 'PointedEars' Lahn said the following on 10/5/2007 2:00 PM:
                        >>>cts1@spvision.c om wrote:
                        >>>>On Oct 4, 9:52 am, Robin <a...@somewhere .comwrote:
                        >>>>>Add a 'unique' variable to the query string of you ajax URI so that
                        >>>>>browser doesn't use the cached copy.
                        >>>>Dang, Robin! That actually works! Not used to getting such good help
                        >>>>the first time around :D
                        >>>>Thanks for the great idea.
                        >>>That idea is BAD because it fills the browser cache with garbage, and so
                        >>>eventually slows down access to other content. Unnecessarily.
                        >>Pure nonsense.
                        >(sic!)
                        >>
                        >It isn't nonsense, it's a fact.
                        >
                        sic !
                        >
                        It is well-known among competent Web developers that IE is suffering a
                        cache issue with XHR when the call method is "GET". And no headers will
                        do anything to it.
                        Where is your proof for that?
                        The only solution is to add a dummy unique variable to the querysting.
                        Non sequitur.
                        *That* is a fact among others !
                        You have to prove that.


                        PointedEars
                        --
                        Prototype.js was written by people who don't know javascript for people
                        who don't know javascript. People who don't know javascript are not
                        the best source of advice on designing systems that use javascript.
                        -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

                        Comment

                        • Bart Van der Donck

                          #13
                          Re: AJAX html won't refresh after data update

                          Thomas 'PointedEars' Lahn wrote:
                          Laurent vilday wrote:
                          >It is well-known among competent Web developers that IE is suffering a
                          >cache issue with XHR when the call method is "GET". And no headers will
                          >do anything to it.
                          >
                          Where is your proof for that?
                          The proof for IE is below.
                          >The only solution is to add a dummy unique variable to the querysting.
                          >*That* is a fact among others !
                          You have to prove that.
                          The XMLHttpRequest method open() initializes a newly-created request, or re-initializes an existing one.


                          | Microsoft Internet Explorer caches the results of HTTP GET
                          | requests in the Temporary Internet Files (TIF) folder. In
                          | most cases, caching improves performance for data that will
                          | not change frequently. To guarantee that the results are not
                          | cached, use POST.

                          If you want to use 'GET' anyway, use a randomized query-string.

                          --
                          Bart

                          Comment

                          • Laurent vilday

                            #14
                            Re: AJAX html won't refresh after data update

                            Thomas 'PointedEars' Lahn a écrit :
                            Laurent vilday wrote:
                            >It is well-known among competent Web developers that IE is suffering a
                            >cache issue with XHR when the call method is "GET". And no headers will
                            >do anything to it.
                            >
                            Where is your proof for that?
                            LOL, and you really pretend to know your stuff ?

                            This issue is *VERY* well known, can't you do a few google search to
                            know what you talking about ?

                            Or better, actually spend more time working with the technology you
                            pretend to know instead of babbling about it ?

                            You will discover a lot of things. Reality is *far* away from anything
                            you keep pretending to know !
                            >The only solution is to add a dummy unique variable to the querysting.
                            >
                            Non sequitur.
                            <p lang="fr">
                            Je comprend pas ta langue gamin, te la joues pas avec ton latin pourri !
                            </p>
                            >*That* is a fact among others !
                            You have to prove that.
                            LOL, why would I have to proove anything ? Since when did c.l.j. became
                            your helpdesk ? I'm not here to educated you ! Do your searches, read
                            books (even bad ones), read webpages, experiment, get *LOT* more of real
                            experience. Then, come back to us if you have any questions !

                            Days after days, you saying a lot of nonsense without prooving much. Why
                            would I have to proove anything more to you when I'm right ?

                            <FAQENTRY>
                            4.45 [IE - XHR - GET] Why is my AJAX page not updated from IE cache when
                            using HTTP GET request ?
                            Microsoft Internet Explorer caches the results of HTTP GET requests. If
                            you need a non cached version of the page, you will have to use a
                            randomized query-string or use a HTTP POST request. No headers or server
                            configuration will do any help to it.
                            <http://msdn2.microsoft .com/en-us/library/ms536648.aspx>
                            </FAQENTRY>

                            ps : Thomas, I already know my english sucks, no need to correct my
                            english grammar errors in this message except the FAQENTRY of course.

                            --
                            laurent

                            Comment

                            • Randy Webb

                              #15
                              Re: AJAX html won't refresh after data update

                              Thomas 'PointedEars' Lahn said the following on 10/6/2007 1:18 PM:
                              Laurent vilday wrote:
                              ><FAQENTRY>
                              >4.45 [IE - XHR - GET] Why is my AJAX page not updated from IE cache when
                              >using HTTP GET request ?
                              >Microsoft Internet Explorer caches the results of HTTP GET requests. If
                              >you need a non cached version of the page, you will have to use a
                              >randomized query-string or use a HTTP POST request. No headers or server
                              >configuratio n will do any help to it.
                              >
                              That is your statement, still lacking proof.
                              When I have tested it extensively, it has proof. If you want proof, then
                              you are welcome to test it yourself.
                              ><http://msdn2.microsoft .com/en-us/library/ms536648.aspx>
                              >
                              There is _nothing_ there that says the caching behavior cannot be controlled
                              by headers. In fact, it would be very weird behavior if IE's HTTP
                              implementation would obey cache control headers in normal operation (and it
                              does) and would not when it is triggered through the IXMLHTTPRequest interface.
                              Perhaps you should follow the rest of the advice in the post you replied
                              to and get out in the real world and find out how things really work
                              instead of trying to defend the way you think things *should* work.
                              Especially when the way you think they work and the way they work are
                              not the same.

                              --
                              Randy
                              Chance Favors The Prepared Mind
                              comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
                              Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

                              Comment

                              Working...