How can I create a live search with Jquery AJAX, I used keypress or keyup event to loop query, but if I type 3 characters or more the AJAX will do 3 times or more.

My form:

Here my AJAX:

And Here is my demo function:

function get_tour()
echo 'Do something!';
<?php die(); }

And this is result when I type 3 characters:
type 3 characters
I type 2 chars:
type 2 characters
Who can help me it work 1 time no matter how many key press. Or it work fine anyway ! Thanks a lot !!

Read more here: Live Search With jquery AJAX?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: