function go_save(){
console.log('saving...');
}
$('button').on('click', function(){
console.log('clicked');
//the above should be written each time the button is clicked
//the next should be executed only if the last click happens 9 seconds in the past
go_save();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<button>CLICK</button>
go_save is an ajax function and I want to prevent it to execute if a user clicks on a button several times at once.
But I don't want to wait for console.log('clicked'), only for go_save()
Any help?