Hello, I created a script in jQuery
that queries the database, based on what the person typed in a input
field. With each key that the user types, the script makes a new request for my API
and this is a problem, since I intend to hire a cheap hosting. So I wanted to know how I can improve the following script so I do not have to keep asking the server all the time and spending the resources of the server I want to hire:
$(document).ready(function() {
$('#input').keyup(function(event) {
var t = $('#input').val();
$.getJSON('api', {word: t}, function(json, textStatus) {
// Em caso de sucesso, essa função será ativa
});
});
});