How can I delay actions between keypress in jQuery. For example;
I have something like this
if($(this).val().length > 1){
$.post("stuff.php", {nStr: "" + $(this).val() + ""}, function(data){
if(data.length > 0) {
$('#suggestions').show();
$('#autoSuggestionsList').html(data);
}else{
$('#suggestions').hide();
}
});
}
I want to prevent posting data if the user continously typing. So how can I give .5 seconds delay?