How to globally override handlers of $.ajax
<p>My app uses <code>$.ajax</code> heavily. The server returns something like <code>{"STATUS":"RELOGIN"}</code> in case the login has expired. Our app is such that the logout on the server happens if the user does nothing for 20 minutes on the app. </p>

<p>All the posts and gets happen through $.ajax and I want to globally change the $.ajax function so that in case the data returned for a request is <code>{"STATUS":"RELOGIN"}</code> I want to make sure that the user is shown some notification if this happens.</p>

<p>I can put this is as the success handler for all the request</p>

<pre><code>function(data){
if(data.STATUS == "RELOGIN") {
    Notifier.show_error("Login again. Session has expired")
    return
}
// rest of the code depending on the request
}
</code></pre>

<p>Where <code>Notifier</code> is something that I have written to show notifications</p>

<p>But I do not think duplication of this code in too many places is a good idea.</p>

<p>I do not want to touch jquery source code. It is beautiful as it is.</p>
