I'm trying to put a delay in front of an AJAX
call.
var delay = 2000;
$("#c_name").on("keyup", function() {
var entered = $(this).val();
if (entered.length > 1) {
setTimeout(dosearch(entered), delay)
}
});
Fo some reason I can't seem to get setTimeout
to take hold. It's performing the dosearch()
function instantly.
How can I get this to delay properly? Yes JQuery 3.3.1
is loaded up top.