How to detect Ajax requests of any kind with Jequery?

0

Is there a way to identify if a request any Ajax request with Jquery?

I've implemented a timeout in my application, to move the user off when the application goes idle. Idle time is refreshed every time I make a request to my server.

My intention is not to renew idle time if ajax requests are made to my server.

I inserted my JavaScript inside my layout page like this:

    var sessionTimeoutWarning = @Session.Timeout- 1;

    var sTimeout = parseInt(sessionTimeoutWarning) * 60 * 1000;

    setTimeout('SessionEnd()', sTimeout);

    function SessionEnd() {
        alert("Sua sessão expirou. Faça login novamente!!!");
        window.location = "/Account/SessionTimeOutLogOff";
    }

I configured my Web.config like this:

<sessionState timeout="16"></sessionState>

The Algorithm I want in Jquery looks like this:

Se NÂO for requisição Ajax {
    Renova tempo de ociosidade;
}
    
asked by anonymous 25.01.2018 / 17:58

0 answers