I am using a script i wrote to get search results displayed underneath in the page, now this works okay i guess but when i type in a long sentance all the request get send to the server and ofcourse the response comes way later and gets kind of stacked up resulting in a fast changing div that i wanted to use to show results in, this is really ugly and annoying and i can't really find any examples on the internet about this.
Here is my AJAX script that triggers the ajax call.
$(".harmster_form_replace_onchange input[type=text]").live("keyup paste", function(e){
if($(this).val().length >=2 || e.keyCode==8)
{
var form = $(this).closest('form');
var target = $(form).attr("target");
loader_img(target);
var url = $(form).attr('action');
$($(form).attr("target")).hide();
$($(form).attr("target")).fadeIn('fast', function(){
$.post(url, $(form).serialize(), function(data){
$(target).html(data);
});
});
}
return false;
});