I have an Ajax jquery function ($.post) that retrieves json data. One of the ways it gets executed is by keydown ($('#lkj').keyup(function(event)) with a 250 ms delay. One problem however is that the data retrieved is not always up to date. Especially when the user has a high ping towards the server. When i for example type "test", the jquery .post script will get (depending on my typing speed) executed between two to four times: 

1. t
2. te
3. tes
4. test

Sometimes the instance containing "te" is slow and is last the complete and therefore overwrites the output written by the instance containing "test". How do I prevent that?