I have users making ajax call while typing. The problem is that it makes the call for every letter being typed, so I set timeout like this:

```
$(input).live('keyup', function(e){

setTimeout(function(){ 

var xx = $(input).val();
doSearch(xx); 

}, 400); 

}); 

```

It does wait for 400ms but then executes for every keyup. How can I change this to make the ajax call only 'once' about 400ms after the last typed letter? 

(I used 'delay' in the past but that doesn't work at all with my script...)