ajax form

<% form_remote_for :user, @user, :url => { :action => "create" } do |f|
%>
.
.
<%= submit_tag "Add user" %>

controller:
  def create
    @user = User.new(params[:user])

    if @user.save
      if(request.xhr?)
             flash[:notice] = "OK ADDED"
             redirect_to :action => :index
      else
        flash[:notice] = "not xhr"
      end
    end
  end

When I run this, it doesn't seem to pass request.xhr? so it never
redirects.

What's wrong with this?

Justin To wrote:

<% form_remote_for :user, @user, :url => { :action => "create" } do |f|
%>
.

Are you still nesting one form inside in another. Are you including
prototype (javascript_include_tag) ?

Fred