I am currently working on an autocomplete search bar feature.
<input type="text" class="form-control" id="text" >
<script>
$("input").keyup(function(){
let key = $("input").val();
$.ajax({
url: '/search',
type: 'POST',
contentType: "application/json",
data: JSON.stringify({key}),
success: function(data){
console.log("SUCCESS")
}
});
});
</script>
As users input text into the search box, I aim to send each keystroke to the backend server for suggesting results. However, this quickly triggers the maximum of 6 concurrent AJAX requests. How can I address this issue?