I’m Using Rails3 and the Unobstrusive Javascript Gem jquery-rails.
Remote deletion (without page reload) works well using code like:
<%= link_to "Delete", user, :method => :delete, :confirm => "Are you sure?", :remote => :true, :title => "delete user, :class => "delete"%>
But how can I call a JavaScript function when the user clicks okay in the dialog? The goal is to hide a specific element on the site after the deletion.
If I’m right you just add delete.js.erb (with the js code you want to execute) in your users view folder :
And in your users_controller.rb