Ajax doesnt work on ruby on rails -
this clear method of catalog_controller
def clear @page_title = 'vaciar carro' if request.xhr? @cart.cart_items.destroy_all flash[:cart_notice] = "carro vaciado." render :controller => 'cart', :action => 'clear_with_ajax' elsif request.post? @cart.cart_items.destroy_all flash[:cart_notice] = "carro vaciado." redirect_to :controller => 'catalog' else render :controller => 'cart', :action => 'clear', :template => 'cart/clear' end end
this clar_with_ajax.js.erb code
jquery.noconflict(); jquery('#shopping_cart').html("<%= j render :partial =>'cart/cart' %>");
and that's part of view calls clear method
<p id='cart_total'><strong>total: <%= sprintf "%0.2f €", @cart.total %></strong></p> <% unless @cart.cart_items.empty? %> <p id='clear_cart_link'> <b><%= link_to 'vaciar carro', :controller => 'cart', :action => 'clear' :remote=> true %></b> </p>
since have added remote => true on view "vaciar carro" link nothing.
Comments
Post a Comment