Remove from cart functionality......

hi all,

I am getting a problem when I am trying to remove an item from the cart using Ajax. I have a view named display_cart.rhtml, a controller store_controller.rb and a model cart.rb. I have written a method named remove_from_cart in store_controller.rb and javascript in display_cart.rhtml to display total cost after deleting the item from the cart. The method is: def remove_from_cart product = Product.find(params[:id])   @cart = find_cart    @cart.remove_product(product)    redirect_to :action => "display_cart" and return false end.

This is probably to do with the bit you haven't show us :-), ie whether your link_to_remote is set to update a div (which one?) and what is in display_cart.rhtml

Fred

don't use :position => 'top': that means 'add the returned content to the top of the named div', whereas what you want is to replace the content of the named div

Fred