Hi. I have a Rails app where I was doing a general delete dialog with "are you sure" before it gets deleted. That's all fine, but I also have a small ajax on click to remove the block containing all the information. The block gets removed no matter what which makes things confusing. I couldn't seem to find any documentation online on how to conditionally execute an action after the confirm symbol.
My code looked like this:
<%= link_to_remote "Delete", :url =>
{:controller => "pixel", :action => :destroy, :id => pixel.id},
:onclick=>"$(this).up(0).remove()" %>
Thanks!