This can be applied for a success (change the button to a green tick mark) or an unsuccessful action (change the button to a red x mark).
But what if you want to give details on why the action was unsuccessful? How do you show it near the button or change the button itself?