How can I implement a setup and undo feature for my ajax calls that allows users to delay the call for a set amount of time and abort it if needed? I also want to be able to stop the delay and proceed with the most recent ajax call if another action is triggered.
For instance, if I send an email and have 5 minutes to undo the action, I should be able to send another email to replace the first one and give it another 5 minutes for potential undoing.
I am curious about the best approach to achieve this functionality. Any suggestions?