Here is my code:
$("input").on('keydown', function(){
$.ajax({
url : '/files/tags_autocomplete.php',
dataType : 'JSON',
success : function (tags) {
$("ul").html(tags.output);
}
});
});
It works as well and all fine. Just sometimes tags_autocomplete.php
returns a response after 8sec (which is too much) or sometimes it totally fails and doesn't return a response.
Anyway, I want to make a something went wrong
mechanism which should be run 4sec after sending that ajax request. How can I do that?