I'm updating search results as the user types the search term.
When 2 ajax calls happen, sometimes the last one data_response
is brought back first. I need to make sure this doesn't happen.
This is my code:
function filterCities(search) {
$.ajax({type:'GET',url:'/ventas/theme/citiesContainer.php',data: "search=" + search,
success:function(data_response){
results.innerHTML = data_response;
}});
}
How do I cancell previous instances of the same request when I make a new one?