title: passing data json in rails coffeescript and ajax
body: <p>I tried different ways to retrieve json-data  unsuccessfully</p>
  
  <p>my order.js.coffee</p>
  
  <pre><code> $.ajax(
    url: "/orders/", // want "/orders/1"  
    dataType: "JSON"    
   ).done (data) -&gt;
     console.log data.status
  </code></pre>
  
  <p>my controller:</p>
  
  <pre><code>class OrdersController &lt; ApplicationController
  respond_to :json, :js, :html
  
  
  def show
    @order = Order.find(params[:id])
    respond_with @order
  end
  ....
  </code></pre>
  
  <p>my show.json.jbuilder</p>
  
  <pre><code>json.extract! @order, :id, :status
  </code></pre>
  
  <p>and here my route:</p>
  
  <pre><code>get '/orders/:id', to: 'orders#show', defaults: {format: :json}
  resources :orders, only: [:new, :create]
  ...
  </code></pre>
  
  <p>I got a lot of errors with different approach.</p>
  
  <pre><code>Started GET "/orders/" for 127.0.0.1 at 2014-10-07 01:07:36 +0200
  
  ActionController::RoutingError (No route matches [GET] "/orders"):
  </code></pre>
  
  <p>or</p>
  
  <pre><code>ERROR bad URI `/orders/%3C%=%20order.id%20%%3E'
  </code></pre>