I've developed a line of business application for a client where a class of user is automatically logged out after 5 minutes of inactivity. We set it up so every time the user accesses a page (either using AJAX or a 'normal' request) it automatically resets the timer and everything was good. Except for the fact that the user didn't know they were being logged out and then when they submitted a form data would be lost.

To solve this we added a timer to the user's screen to display how much time they had left until they were logged out. The problem was that we couldn't determine how much time was left because every $.post and $.get reset the timer on the backend so we couldn't request that information and all those additional requests would add load to the server. We didn't want to have to rewrite all our $.get and $.post calls for this one class of user so we had to find a different solution. It turns out you can override them very easily.

$(function(){
    // Store a reference to the original remove method.
    var originalGetMethod = jQuery.get;

    // Define overriding method.
    jQuery.get = function(data){
        // reset the timer

        // Execute the original method.        
        return originalGetMethod.apply( this, arguments);
    }
});

This is a very simple example but you could use this to queue connections to the server or inject a value (like an id for the page/user) into every request.