[LRUG] Redirect in ajax.

Pratik pratiknaik at gmail.com
Sun May 2 04:36:15 PDT 2010


render(:update) {|page| page.redirect_to whatever_path }

On Sun, May 2, 2010 at 12:31 PM, Oliver Stocks <stocks.oliver at gmail.com> wrote:
> Hello comrades,
>
> I wondering if it's possible to redirect a browser in AJAX, i failed a few
> years but i didn't this group! I'm remaking the sliding panel the code in
> only a draft for now:
>
> test_controller.rb
>   # Login
>   def create
>     @user_session = UserSession.new(params[:user_session])
>
>     if @user_session.save
>       # Login, Geat !
>       if (request.xhr?)
>         # TODO: Find how it redirect
>         render :text => "Login successful!"
>       end
>     else
>       # Login is wrong
>         @warning = "Wrong login or/and password!"
>         render :partial => "form_wide"
>     end
>   end
>
> I can make a normal form but if the login info is wrong, if feel that
> reloaded the entire page is a bit worthless.
> Any help is help! I doubt i can it, do but invalidrecord stated you
> awesomeness.
>
> Oliver Stocks
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>



-- 
Programmer @ 37signals | http://twitter.com/lifo | http://m.onkey.org



More information about the Chat mailing list