Easy way to redirect to "Please Wait" page while JSON request completes?

Hello friends -

I have a rails app that uses JSON to send requests to another server. That server processes the request and sends a JSON response back to the rails app.

At first I was sending the requests using AJAX but the requests may take up to 30 seconds, and users double-submitted, reloaded, etc. So, I was thinking that upon submitting a request, I could then have rails forward to a “Please wait while we are processing your request” page. From there, rails will send the request and wait for a response. When the response is received (or a timeout of 45 seconds is reached), I can redirect appropriately to the result page.

My question is, I am not sure how to achieve this effect of having a “Please wait” page while asynchronously checking another server for a result. Does anyone have any tutorials/advice/links on how to achieve this?

Alternatively, I have seen (using prototype or jquery) sites where when you press the submit button, the screen greys out and a window is tiled on top informing the user that the request is being processed. Is it possible to utilize this method using ajax?

Thanks, Jin

You can just use a loading panel (that is also modal) to keep the user from double submiting -> http://thecodecentral.com/2008/01/17/a-yui-loading-panel-widget