[LRUG] Redirect in ajax.

Oliver Stocks stocks.oliver at gmail.com
Sun May 2 04:31:14 PDT 2010


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20100502/b8e039d4/attachment-0003.html>


More information about the Chat mailing list