You can combine the redirect in same view as for the failing, or make
2 views. Your controller can use $this->render('success') or $this-
>render('failure') OR
$this->set('failure', 1) and use a condition in the view.

I try to be more precise with a sample (I am not good at this) :

In you login view :

...
...
<?php echo $ajax->submit(... .. ... array('update' => 'mydiv')); ?>
<div id ="mydiv"></div>

In your view or 2 views you will update the same div, difference
being :

1) on failure, you will probably "fill up" your div with message, html
etc...

    <?php $ajax->div("mydiv"); ?>
    <p>Error</p>
    .....
    <?php $ajax->divEnd('mydiv'); ?>


2) on success, you will write smething like :
    <?php $ajax->div("mydiv");
        $js = "window.location.href='".FULL_BASE_URL.$this->html-
>url('/Controller/action')."'";
        echo $javascript->codeBlock($js);
        $ajax->divEnd("Mydiv");
     ?>


I wrote this "code" straight into the edit message, so I am sure a
copy/past will probably fails, but that might give you some hints.

On Jul 10, 4:20 pm, Michael Augustyniak <[EMAIL PROTECTED]>
wrote:
> francky06l wrote:
> > Seems if you want to update a div on error, you should make $ajax-
>
> >> submit first.
>
> > Then your "div to update" could contain some values in case of error
> > or an url in case of success. Now if you want this redirection to be
> > html (not ajax), just use a javascript (window.location) ..
>
> yes I undarstand
>
> but not sure where to use window.location should be on complete action ?
> I do not think so because I want redirect on success only.
>
> Thank You for help


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to