As @polesye wrote:

<code>Why you don't abort previous request instead?
The jquery ajax method returns a XMLHttpRequest object. You can use this object to cancel the request.
So, as result we will have more simpler function, remove extra flags, like request_visible etc.</code>