title: Rails 4 ajax proccessing as html
body: <p>I'm trying to get ajax working for my contact form and currently I'm trying to test to make sure the ajax is getting called.</p>
  
  <p>In my console I can see that it's still getting processed as HTML and I cant figure out why.</p>
  
  <pre><code>#app/views/contact_mailer/_contact_me.html.haml
  = form_for @message, url: contact_path, authenticity_token: true, remote: true do |f|
    = render 'layouts/error_messages', object: f.object
    = render 'layouts/flash'
    = f.label :name
    = f.text_field :name, :placeholder =&gt; 'Enter your your name...'
  
    = f.label :email
    = f.text_field :email, :placeholder =&gt; 'Enter your email address...'
  
    = f.label :subject
    = f.text_field :subject ,:placeholder =&gt; 'Enter your subject...'
  
    = f.label :body
    = f.text_area :body, :placeholder =&gt; 'Enter your message...', :size =&gt; '25x15'
  
    = f.button 'Send', :id =&gt; 'send-button', :class =&gt; 'darkgreen-button'
  </code></pre>
  
  <p>Somewhere In my messagesController I also need to fit a call to ContactMailer.contact_me(@message) but I'm not quite sure where I would add that.</p>
  
  <pre><code>class MessagesController &lt; ApplicationController
    def contact
      @message = Message.new(params[:message])
      respond_to do |format|
        if @message.valid?
          format.html { redirect_to contact_path, notice: 'Message was sent successfully.' }
          format.js {  }                                                                                                                                                                                                                                                                                                                                                                      
        else
          format.html { render file: 'pages/contact' }
          format.js { }
        end
      end
    end
  end
  </code></pre>
  
  <p>Finally I try to respond with a console log but it never shows up</p>
  
  <pre><code>#app/views/messsages/contact.js.haml
  console.log("AJAX Called!")
  </code></pre>
  
  <p>*EDIT Application.js</p>
  
  <pre><code>// This is a manifest file that'll be compiled into application.js, which will include all the files
  // listed below.
  //
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
  // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
  //
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
  // compiled file.
  //
  // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
  // about supported directives.
  //
  //
  //= require analytics.js.coffee
  //= require turbolinks
  //= require bootstrap.min
  //= require_tree ./global
  </code></pre>