0 Replies Latest reply on Nov 17, 2010 11:00 AM by nmpoojary

    How to retrieve Ajax response after browser ReceiveTimeout?

    nmpoojary

      I'm currently working on an issue in our web app. I have an ajax request which possibly can take longer time than the browser RecieveTimeout to get the response back from the server. I'm using Rich faces on IE8.

       

      Issue:

      Ajax request stops when ReceiveTimeout occurs and user does not get to know what's going on with the request he/she made. When server completes processing the request and ready with the response, if I refresh the browser page, I get the expected response displayed on the result section of the page.

       

      What I have so far:

      Instead of manually refreshing the browser after I get to know server is ready with the response, I have a4j:poll in my page which re renders itself and result section of the page for every 1000ms (as in my example). As of now, I do not have any logic built to kick off this poller automatically once ReceiveTimeout occurs. So, manually I start the poller once ajax request gives up after the timeout. Then poller keeps refreshing itself and result section of the page until server completes with its processing and disables the poller (Here I have a server side boolean variable to enable/disable the poller).

       

      What I think I'm looking for:

      I think I should have a poller to kick of automatically when Ajax request gives up after ReceiveTimeout, have it keep checking for the response from the server for every defined number of milliseconds and complete the request without server side knowledge (without having any server side variable to keep track of when to enable/disable the poller).

       

      Let me know if anyone had similar situation and got through with it. Share your ideas if you have.

       

      Thanks,

      Nagaraj