Bind a keyup event to check the contents and make a request when the content changes. To throttle requests, use setTimeout .
$("#input").keyup(function(e){ if (window.liveSearch) clearTimeout(window.liveSearch); window.liveSearch = setTimeout(function(){
To improve performance, you can save the search by object (for example, the cache ["some search"] = results), and if the same request is made, you do not need to query the server again.
source share