title: Rails remote form submit not working
body: <p>I'm trying to submit a form via ajax/js.  When I set :remote => true it still submits via html.</p>
  
  <pre><code>&lt;%= form_for(@message), :remote =&gt; true, do |f| %&gt;
  
    &lt;%= f.label :Note_To_Doctor %&gt;
    &lt;%= f.text_field :note %&gt;
    &lt;%= f.collection_select(:physician_id, Physician.all, :id, :physician_name )%&gt;
  &lt;%= f.button :send, :class =&gt; 'btn btn-info' %&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <p>I could have sworn I've done it like this.  Do I need to create a create.js.erb and if so, what should go inside of it.  Also, what should I put inside the create action as a respond block?</p>
  
  <p>controller:</p>
  
  <pre><code> def create
      @message = Message.new(params[:message])
  
      if @message.save
        MessageMailer.paging(@message).deliver
        respond_to do |format|
           format.html { redirect_to messages_path, flash.notice = "Message was sent" }
           format.js { render "index" }
         end
      else
        @message = Message.new(params[:message])
      end
    end
  </code></pre>
  
  <p>index.js.erb</p>
  
  <pre><code>$("#messages").html("&lt;%= escape_javascript render("messages") %&gt;");
  </code></pre>