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

**URL:** <https://www.ruby-forum.com/t/easy-way-to-redirect-to-please-wait-page-while-json-request-completes/147749>\
**Category:** Rails\
**Created:** [September 5, 2008, 12:27am UTC](https://www.ruby-forum.com/t/easy-way-to-redirect-to-please-wait-page-while-json-request-completes/147749 "2008-09-05T00:27:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![typej](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f1d935/32.png) [@typej](https://www.ruby-forum.com/u/typej)\
**Post date:** [September 5, 2008, 12:27am UTC](https://www.ruby-forum.com/t/easy-way-to-redirect-to-please-wait-page-while-json-request-completes/147749/1 "2008-09-05T00:27:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![typej](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/f1d935/32.png) [@typej](https://www.ruby-forum.com/u/typej)\
**Post date:** [September 5, 2008, 12:30am UTC](https://www.ruby-forum.com/t/easy-way-to-redirect-to-please-wait-page-while-json-request-completes/147749/2 "2008-09-05T00:30:37Z")

</div>

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](http://thecodecentral.com/2008/01/17/a-yui-loading-panel-widget)

On Thu, Sep 4, 2008 at 7:26 PM, Jin L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> the request and wait for a response. When the response is received (or a  
> utilize this method using ajax?
> 
> Thanks,  
> Jin
> 
> >

–  
Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)  
João Pessoa, PB, +55 83 8867-7208
