title: how show flash error messages in Rails 3 using Ajax and Jquery?
body: <p>my controller create function is</p>
  
  <pre><code>def create
    @group = Group.new(params[:group])
    @group.company=current_user.company
    respond_to do |format|
      if @group.save
        format.html { redirect_to(@group, :notice =&gt; 'Group was successfully created.') }
        format.js
      else
        flash.now[:error]=@group.errors.full_messages
        format.html { render :nothing =&gt; true }
        format.js
      end
    end
  end
  </code></pre>
  
  <p>create.js.erb file is </p>
  
  <pre><code>$('&lt;%= escape_javascript(render(:partial =&gt; @group))%&gt;').appendTo('#groups');
  $("#new_group")[0].reset();
  </code></pre>