[Catalyst] How to display a "Please Wait" page

Toby Corkindale tjc at wintrmute.net
Mon Aug 11 03:49:37 BST 2008


On Sun, Aug 10, 2008 at 09:22:40PM -0500, Collin Condray wrote:
> I am in the process of creating a website using catalyst. I have a check out
> page that processes payment information and performs some automated tasks
> for the client that takes several seconds to complete. I'd like to display a
> "Please Wait" graphic while these actions are occurring.
> 
> I my initial attempt was something like this:
> 
> $c->response->redirect( $c->uri_for("/checkout/pleasewait") );
> 
> # Do action and payment process
> 
> $c->response->redirect( $c->uri_for("/checkout/receipt") );
> 
> But that was unsuccessful. I definitely think I'm misunderstanding how
> redirect works. Has anyone else done anything like this before and if so
> what are the steps that need to be taken to make it work?

Do you understand how HTTP redirect works? If so, then understand that the
catalyst response->redirect is essentially exactly the same.
As a result, you can only send one, and when the client receives it, they will
leave the current page.

Perhaps try making pleasewait(), do_payment_process() and receipt() actions.
Send the user to the pleasewait one, which just displays a "Please wait.."
page, and kicks off the payment processing in the background. Have it set up to
move the user over to the receipt() page once things are complete. (You can do
this via javascript, but remember to have a fixed old-school http redirect with
a time-out too, in case the user has an antique browser, or something goes
wrong).


Cheers, Toby


-- 
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --recv-key B1CCF88E)



More information about the Catalyst mailing list