Success message when using button_to_remote


In a partial I used button_to_remote for deleting record.

My record is deleted but message is not firing.

<%= button_to_remote "Delete", :url => {:controller => "users" ,
:action => "deletegroup", :group_name=>grouprow.group_name}, :class =>
"submit_input_button rounded_corner" %>

Action in Controller
def deletegroup
    puts "in delete group"
   puts params[:group_name]


   puts @grpfriends

   @grpfriends.each do |f|


   @msg="Group deleted successfully."

   respond_to do |format|
    flash[:notice] = @msg
    format.html {redirect_to :back}


Please help how I can display a success message "Group deleted

Thank you.

With a button_to_remote like that you're going to have to display the
message yourself - either supply an onSuccess callback or write some
rjs / call an rjs template ni your respond_to block that displays a