javascript/jquery - add debounce to a button
I want to add a debounce to a button, but i want to perform some actions each time user clicks button, but only after 5 second after user hits button, then perform SQL update. Usually the throttle seems to be applied directly to the listener. Here I want some actions performed each time the button is clicked, and then an update after a reasonable waiting period. I am not sure how to use the function in this case... reference: http://code.google.com/p/jquery-debounce/ $('#myButton').click(function() { // do a date calculation // show user changes to screen // wait until user has has stopped