title: Rails 3: How to "redirect_to" in Ajax call?
body: <p>The following <code>attempt_login</code> method is called using Ajax after a login form is submitted.</p>
  
  <pre><code>class AccessController &lt; ApplicationController
    [...]
    def attempt_login
      authorized_user = User.authenticate(params[:username], params[:password])
  
      if authorized_user
        session[:user_id] = authorized_user.id
        session[:username] = authorized_user.username
        flash[:notice] = "Hello #{authorized_user.name}."
        redirect_to(:controller =&gt; 'jobs', :action =&gt; 'index')
      else
        [...]
      end
    end
  end
  </code></pre>
  
  <p>The problem is that <code>redirect_to</code> doesn't work.</p>
  
  <p>How would you solve this ?</p>