# Will\_paginate with ajax

**URL:** <https://www.ruby-forum.com/t/will-paginate-with-ajax/174032>\
**Category:** Rails\
**Created:** [August 19, 2009, 6:18pm UTC](https://www.ruby-forum.com/t/will-paginate-with-ajax/174032 "2009-08-19T18:18:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![soller](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2acd7d/32.png) [@soller](https://www.ruby-forum.com/u/soller)\
**Post date:** [August 19, 2009, 6:18pm UTC](https://www.ruby-forum.com/t/will-paginate-with-ajax/174032/1 "2009-08-19T18:18:27Z")

</div>

I tried to delete from a datatable that I represent with will\_paginate  
and ajax. In the view there are something like that:

 \<% @items.each do |i| %\> "\> \<%= i.name %\> \<%= i.quantity %\> \<%= i.price %\> \<%= link\_to 'Destroy', :method =\> :delete %\> \<% end %\>

In the controller I have this:

def destroy(a)  
@Item = Item.find(:id)  
@Item.destroy  
end

And the web don’t have error but don’t run I have to do with ajax or  
something like that??  
Thank you very much!!

---

<div class="post-metadata">

**Author:** ![soller](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2acd7d/32.png) [@soller](https://www.ruby-forum.com/u/soller)\
**Post date:** [August 20, 2009, 9:48am UTC](https://www.ruby-forum.com/t/will-paginate-with-ajax/174032/2 "2009-08-20T09:48:56Z")

</div>

\<%= link\_to ‘Destroy’,:confirm =\> ‘Are you sure?’,:action =\>  
‘destroycat’,:id =\> p.id, :method =\> :delete %\>

and controller like this

def destroycat  
@pro\_categorie = ProCategorie.find(params[:id])  
@pro\_categorie.destroy  
respond\_to do |format|  
format.html { redirect\_to(admins\_url) }  
format.xml { head :ok }  
end  
end
