Topic: Jquery post request

I'm using JQuery in my application.
So i'd want when the user click on the link "Delete all" , the link would act like a button and do a post request; also, while the request is working, i'd like to show some loading gif to the user where the link button was.

Currently I'm doing like this, it works:

controller:

def delete_all
    #some code
end

view:

<%= link_to 'Delete all', delete_all_admin_products_path, :confirm => "Are you sure?", :method => :delete, :class => 'button' %>

route:

map.namespace :admin do |admin|        
    admin.resources :products, :collection => {:delete_all => :delete}
end

However, I'd want to do without reloading the entire page, only the part where the products are, and doing it like I described in the beginning of the post. Also, the way i'm doing, the user could enter the url products/delete_all, and I dont want that.
Any tip will be appreciated, as well any tutorial link or anything at all. I saw something about it, but I'm confused how to do.

Last edited by JobaDiniz (2010-05-31 15:01:14)