title: ajax not working on rails 4
body: <p>I've looked everywhere but can't seem to find the problem why my AJAX request is not going through for adding items to Cart.</p>
  
  <p>line_items_controller.rb</p>
  
  <pre><code>def create
    product = Product.find(params[:product_id])
    @line_item = @cart.add_product(product.id)
  
    respond_to do |format|
      if @line_item.save
        format.html { redirect_to store_url }
        format.js   { @current_item = @line_item }
        format.json { render action: 'show',
                             status: :created, location: @line_item }
      else
        format.html { render action: 'new' }
        format.json { render json: @line_item.errors,
                             status: :unprocessable_entity }
      end
    end
  end
  </code></pre>
  
  <p>store/index.html.erb</p>
  
  <pre><code>       &lt;% if notice %&gt;
  &lt;p id="notice"&gt;&lt;%= notice %&gt;&lt;/p&gt;
  &lt;% end %&gt;
  
  &lt;h1&gt;Your Pragmatic Catalog&lt;/h1&gt;
  
  &lt;% cache ['store', Product.latest] do %&gt;
  &lt;% @products.each do |product| %&gt;
      &lt;% cache ['entry', product] do %&gt;
          &lt;div class="entry"&gt;
            &lt;%= image_tag(product.image_url) %&gt;
            &lt;h3&gt;&lt;%= product.title %&gt;&lt;/h3&gt;
            &lt;%= sanitize(product.description) %&gt;
            &lt;div class="price_line"&gt;
              &lt;span class="price"&gt;&lt;%= number_to_currency(product.price) %&gt;&lt;/span&gt;
              &lt;%= button_to 'Add to Cart', line_items_path(product_id: product),
                            remote: true %&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      &lt;% end %&gt;
  &lt;% end %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>line_items/create.js.erb</p>
  
  <pre><code>$('#cart').html("&lt;%= escape_javascript render(@cart) %&gt;");
  
  $('#current_item').css({'background-color':'#88ff88'}).
      animate({'background-color':'#114411'}, 1000);
  </code></pre>
  
  <p>line_items/_line_item.html.erb</p>
  
  <pre><code> &lt;% if line_item == @current_item %&gt;
  &lt;tr id="current_item"&gt;
  &lt;% else %&gt;
  &lt;tr&gt;
  &lt;% end %&gt;
  &lt;td&gt; &lt;%= line_item.quantity %&gt;&amp;times; &lt;/td&gt;
  &lt;td&gt; &lt;%= line_item.product.title %&gt; &lt;/td&gt;
   &lt;td class= "item_price" &gt; &lt;%= number_to_currency(line_item.total_price) %&gt; &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I can see in my log file that page sends a bunch of GET requests every time I add an item to the cart and also I can see it reload. No errors found in the log file.</p>
  
  <p>restarted the site several times. checked if I have jquery and jquery-ui gems installed properly. Nothing changed.</p>