Computer Magic Logo
Global ajax listener

Friday, January 22, 2016

Published by Aristotelis Pitaridis

The code below allows us to know when we have an ajax call and also we know when the ajax successfully completed. This is useful when we want to display an animated gif during the ajax call.

    $("body").ajaxStart(function() {
    $("body").ajaxSuccess(function(event, xmlHttp, options){
        var status = xmlHttp.statusText;
        var url = options.url;
        var data =;