IIRC, you cannot do that with AJAX requests.

Since you're already using Auth component, you can set the Auth-
>ajaxLogin variable (in your AppController) to contain the appropriate
error and handle that condition accordingly in your javascript.


On Jul 15, 4:01 pm, Luke <eik...@hotmail.com> wrote:
> Hi,
>
> I am still working on my first Cake Project and I am now stuck in some
> AJAX Request where I would need some feedback.
>
> I am trying to achieve the following.
>
> I have recipes everybody can see. There is a link above the recipe to
> add it to your favorites. If you are logged in the page should check
> if you have it already saved, than the link should show "Already in
> cookbook" otherwise "Add to favorites". Next step is when you want to
> add it, you have to be logged in, otherwise the login window should
> show up.
>
> The "Add to cookbook" I wanted to do with AJAX in the background.
>
> So I am using
>
> if($this->Auth->user() == null)
> {
>       $this->redirect('/users/login');
>
> }
>
> in my addToFavorites($id) to check if the User is logged in, if not,
> the Login Form shows up above the recipe. But what I actually would
> like to reach is that the recipe doesn't show up at all anymore but
> instead just the Login Form. If you are than logged in, you should be
> seeing the recipe again and the link should have changed.
>
> I suppose it happens, because I am only replacing the content in the
> <div> with AJAX. Is there any chance to stop the AJAX response and
> instead re-load the full page or what would you guys suggest?
>
> Thanks for any advice. Luke
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to