javascript - How to find time elapsed between two consecutive requests? -


i have 2 checkboxes on selection of each 1 raise ajax request in order response server. need call method when there atleast 2 seconds gap after last request made. idea? means not want call methods when checkboxes clicked continously less 2 seconds gap.

set timeout activated in 2 seconds, , cancel , restart whenever clicks checkbox.

var timeout; var checkboxclickhandler = function() {     cleartimeout(timeout);     var timeout = settimeout(function() {           // logic.     }, 2e3); }; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -