I have a jQuery.ajax()
inside a function named helloworld()
. Whenever the user types inside a search input:
<input type="search" id="search">
I want to run that function whenever the user has typed at least 3 letters inside it. And I only want to run it after 1 second from the point that they released the key. So delay of 1 second, otherwise, it will run continuously while they are typing.
What's the appropriate approach to this?
EDIT: Judging by the comments, I am looking to "debounce" the function.