Ajax call returning prematurily

Discussion in 'Javascript' started by Simon_21, Mar 19, 2008.

  1. Simon_21

    Simon_21 Guest

    Hi All,

    Browser - IE 6.0
    Server - Jboss 4.2.1 (Tomcat 6.0)

    We are making call to the server using ajax to get some data. In a
    worst case scenario the backend thread may take as long as 1 minute to
    return. But sometimes what happens is I get the callback prematurily
    saying that data is available. In other words,
    onreadystatechange=function() gets triggered.

    I debugged from the server side to see if the servlet (processing the
    original request) is calling back and I don't see that happening.

    I tried to use "new ActiveXObject('Msxml2.XMLHTTP.5.0').setTimeouts()"
    to increase the timeout but it seems that call is not valid for the
    client object.

    Is there a way I can increase the time out.

    Thanks
    Rajesh
    Simon_21, Mar 19, 2008
    #1
    1. Advertising

  2. Simon_21 wrote:

    > We are making call to the server using ajax to get some data. In a
    > worst case scenario the backend thread may take as long as 1 minute to
    > return. But sometimes what happens is I get the callback prematurily
    > saying that data is available. In other words,
    > onreadystatechange=function() gets triggered.


    Well check the readyState property for value 4 to ensure you process the
    complete response.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Mar 19, 2008
    #2
    1. Advertising

  3. Simon_21

    Simon_21 Guest

    On Mar 19, 11:23 am, Martin Honnen <> wrote:
    > Simon_21 wrote:
    > > We are making call to the server using ajax to get some data. In a
    > > worst case scenario the backend thread may take as long as 1 minute to
    > > return. But sometimes what happens is I get the callback prematurily
    > > saying that data is available. In other words,
    > > onreadystatechange=function() gets triggered.

    >
    > Well check the readyState property for value 4 to ensure you process the
    > complete response.
    >
    > --
    >
    >         Martin Honnen
    >        http://JavaScript.FAQTs.com/


    Thanks for the reply.
    I did check that unfortunately in both case it is 4. I also did a dump
    of the getResponseHeaders() to see if there is a difference between
    the legitimate repsonse and invalid one and unfortunately no luck.
    Simon_21, Mar 19, 2008
    #3
  4. Simon_21 wrote:
    > On Mar 19, 11:23 am, Martin Honnen <> wrote:
    >> Simon_21 wrote:
    >>> We are making call to the server using ajax to get some data. In a
    >>> worst case scenario the backend thread may take as long as 1 minute to
    >>> return. But sometimes what happens is I get the callback prematurily
    >>> saying that data is available. In other words,
    >>> onreadystatechange=function() gets triggered.

    >> Well check the readyState property for value 4 to ensure you process the
    >> complete response.
    >> [...]


    Please trim your quotes, and don't quote signatures unless you refer
    explicitly to them.

    > Thanks for the reply.
    > I did check that unfortunately in both case it is 4. I also did a dump
    > of the getResponseHeaders() to see if there is a difference between
    > the legitimate repsonse and invalid one and unfortunately no luck.


    Without your posting the relevant code snippet or the URL of a test case it
    is impossible to say whether your assessment of the situation is correct.

    http://www.jibbering.com/faq/faq_notes/clj_posts.html


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
    Thomas 'PointedEars' Lahn, Mar 19, 2008
    #4
  5. Simon_21 wrote:

    > I did check that unfortunately in both case it is 4. I also did a dump
    > of the getResponseHeaders() to see if there is a difference between
    > the legitimate repsonse and invalid one and unfortunately no luck.


    Does that happen with different browsers? Or just one particular browser?

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Mar 20, 2008
    #5
  6. Simon_21

    Simon_21 Guest

    On Mar 20, 8:52 am, Martin Honnen <> wrote:
    > Simon_21 wrote:

    [....]>
    > Does that happen with different browsers? Or just one particular browser?


    It only happens with IE (actually 6.0 (tried with different
    subversions and service packs), didn't try 7.0 as that is not a viable
    option).

    On Firefox, I was not able to reproduce this. If that is the case was
    planning to use 'Firebug' to see what was actually going on. With IE
    MS Script Editor doesn't seem to help much.

    Thanks
    Rajesh

    >
    > --
    >
    >         Martin Honnen
    >        http://JavaScript.FAQTs.com/
    Simon_21, Mar 20, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    11
    Views:
    662
    Christos Georgiou
    May 2, 2006
  2. minnie
    Replies:
    1
    Views:
    684
    Andrew Thompson
    Dec 13, 2006
  3. PSY
    Replies:
    3
    Views:
    13,206
  4. Mike C.
    Replies:
    0
    Views:
    424
    Mike C.
    Sep 19, 2008
  5. PSY
    Replies:
    1
    Views:
    183
Loading...

Share This Page