I am working with an ExtJS client-side program that communicates with the server using synchronous AJAX. Most responses are received in less than 1 second, but occasionally, there are some cases where the server takes 10 seconds or more to process commands. In order to notify the user that this delay is expected and not a bug, I need to implement a mechanism (like a "pls wait" form).
So, what I envision is:
- Send request;
- Set a timeout to 'show loading form' after 2 seconds;
- Wait for response;
- Close loading form once response is received;
- Process the response.
Is there a way to execute a function while waiting for a synchronous AJAX response?
P.S. I am currently using synchronous AJAX due to legacy reasons and it cannot be changed (the best option would involve over 6 months of work).