I have a script that searches my site for duplicate content as a user is typing in the title of a new post (just like on Quora). Right now it fires off a post request on keyup, leading to stacking of post requests.
Any ideas on the best way to avoid this?
$("#topic_title").keyup(function(){
var search_val=$(this).val();
$.post('/?post_type=topic&duplicate=1',{s:search_val},function(data){
if(data.length>0){
var results = $(data).find( '#results' );
$("#duplicates").html(results);
}
});
});
** Thanks for all of the quality answers! I went with the abort() method for simplicity. Works like a charm.