[Catalyst] Ajax and redirect

Andreas Marienborg omega at palle.net
Mon Apr 10 14:18:03 CEST 2006


On 10. apr. 2006, at 14.02, fayland wrote:

>> Generally, I think JavaScript refreshes are done with:
>> window.location( url );
>
> I tried it, and unfortunately it doesn't work. my code as follows:
>
> unless ($c->user_exists) {
>     $c->res->body(<<HTML);
> <script>
>     top.location = '/login';
> </script>
> HTML
>     $c->log->debug('11111111111111');
> }
>
> obviously, 1111111 is printed, but the page doesn't redirect. and  
> any other tips?


the interesting is what your browser does. If you use prototype, you  
need to do the ajax-call wit evalScripts set to a true value, if not,  
the <script> tags will not be loaded as javascript.


andreas




More information about the Catalyst mailing list