title: Rails - How to re-render partial after Ajax GET method request
body: <p><em>Rail4,jQuery Ajax</em></p>
  
  <p>I need to display order for one day which chosen on - jQuery Datepicker.</p>
  
  <p>I set up Ajax request and make some staff into my contoroller but I can't to make it works. Need advise.</p>
  
  <p><strong>Order_controller</strong></p>
  
  <pre><code>def index
    @order = params[:date] ? Order.where(date: params[:date]) : Order.get_order_today
    respond_to do |format|
      format.html # render index.html.haml 
    end
  </code></pre>
  
  <p>end</p>
  
  <p><strong>order.js.coffee</strong></p>
  
  <pre><code>$ -&gt;
    $('#datepicker').datepicker dateFormat: 'yy-mm-dd', onSelect: (dateStr) -&gt;
       $.ajax -&gt;
          type: "GET",
          url: "orders/index",
          dataType: "html",
          data: {date: dateStr}
          success: -&gt;
             # Should i do something here for render default index view?
             console.log("everything is ok ;)")
  </code></pre>
  
  <p><strong>view/orders/index</strong></p>
  
  <pre><code>     #order.col-xs-12.col-sm-6.col-md-8
          = render 'orders/order'
       #datepicker.col-xs-6.col-md-4.date-picker-div
  </code></pre>
  
  <p><strong>view/orders/_order</strong></p>
  
  <pre><code>%h3 Order info
  %table.table.table-striped
    %tr
     %th Meal
     %th Price
   - if (!@order.nil?)
     - @order.products.each do |one_order|
       %tr
        %th=one_order.product_name
        %th=one_order.product_price
  - else
       %tr
        %th no order yet
        %th
   - if (!@order.nil?)
      .col-md-8
         %span=link_to "Cancel order", delete_order_path(id: @order.id), method: :delete, :data =&gt; {:confirm =&gt; "You Sure?"},
                                            class: "btn btn-primary"
   - else
     .col-md-8
        %span=link_to "Create order", new_order_path , class: "btn btn-primary"
    .col-md-4.total-price-div
    %h4 Order coast: #{get_order_coast}
  </code></pre>
  
  <p><em>- console show me that when day was chosen on datepicker</em></p>
  
  <p><strong>Console:</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/fxgP6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fxgP6.png" alt="enter image description here"></a></p>