blockUI getting removed in setInterval where where ajax call is made
<p>I have the following code snippet where an ajax call is made in every 5 sec interval to check if the response is true. The UI will be blocked till the response received is true and when the response is true the UI will be unblocked. I am using Jquery blockUI v1.0 plugin to block the UI:</p>

<pre><code>$.fn.suspendResumeonConfirm=function(caseNumber,correlationId){ 
var contents=$('&lt;table style="width:240px;"&gt;&lt;tr&gt;&lt;td align="center" style="padding: 5px;"&gt;Waiting for Response&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td  align="center" style="padding: 5px;"&gt;'+
        '&lt;div id="testProgress"  style="height:10px;background:#f1f1f1;"&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td  align="center" style="padding: 5px;"&gt;'+
        '&lt;label class="remainingTime"&gt;  &lt;/label&gt; Seconds Remaining&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;');
        contents.find('div#testProgress').progressbar("destroy").progressbar({value:0}).css("border","1px solid #e4e4e4");
        var progressUpdate=$("&lt;div id='progressUpdate'&gt;&lt;/div&gt;").append(contents);           
        var timeOut=0,
        response=false;         
        $("body").blockUI(true,{message:progressUpdate,css:{width:250}});
        var interval=setInterval(function() {               
            timeOut++;
            if(timeOut % 5==0){
                var param='entityNumber='+caseNumber+'&amp;correlationId='+correlationId+'&amp;entityType=Case&amp;status=REQ';
                $(this).cAjax('POST','CheckRequestStatus.action',param,false,false,'','Error', true);
                response=strResponseText;
                //$(this).cAjax('POST', 'CheckRequestStatus.action',param,true,true,'serviceCallBack','Error', true,{timeOut:timeOut});
                $('#testProgress').progressbar("option", "value", (timeOut/serviceAlterationTimeout)*100);
                $("div#progressUpdate label.remainingTime").text((serviceAlterationTimeout-timeOut));
            }
            if(timeOut==60){
$('#testProgress').progressbar("option", "value", (timeOut/serviceAlterationTimeout)*100);
                $("div#progressUpdate label.remainingTime").text((serviceAlterationTimeout-timeOut));           
                $("body").blockUI(false);                   
                clearInterval(interval);
 }
        }
        , 1000);
};

$.fn.cAjax =  function(cType, cUrl, cData, cCache, cAsync, cFn, cAlert, cPrData,     functionArguments)
{
var self = $(this).eq(0),
    xhrObj = {};
try{
    strResponseText = "";
    xhrObj = $.ajax({
        type: cType,
        url: cUrl,
        data: cData,
        cache: cCache,
        async: cAsync,
        processData:cPrData? true : false,
        // ; Event will be called on Ajax SUCCESS
        success: function(data, textStatus, XMLHttpRequest) {
            if  ((typeof data).toUpperCase() == "OBJECT"){  
                data = JSON.stringify(data);
            }
                if(data.indexOf('Session Expired') != -1){
                    $(window.location).attr('href',  'Dashboard.action');
                }
                else if(data =="System error")
                {
                    var btnObject = {
                            "OK": function()   {$(this).dialog('close');}};
                      $(this).removeLoadingMsg().cDialog('customErrorDialog',sysErrorObj[0],sysErrorObj[1],false,true,null,null,btnObject,false,null,false,"slide","center");
                }
                else{
                    if(cFn &amp;&amp; cFn != '')
                    {
                        if(typeof functionArguments ==   'boolean' || functionArguments)
                            self[cFn](data,   functionArguments);       //calling function by jquery Object notation    
                        else
                            self[cFn](data);
                    }
                    strResponseText = data;
                    return data;
                }
                return false;
    },

        // ; Event will be called on Ajax ERROR
        error:function (xhr, ajaxOptions, thrownError){
                var btnObject = {
                        "OK": function()  {$(this).dialog('close');}},errLabelCon = "";

                errLabelCon = $(this).errorCode(xhr.status);
                errLabelCon = errLabelCon.split(",");
                //abort handling. Callback function will receive   first argment as string "ABORT" and passed arguments if any
                if(ajaxOptions == "abort")
                {
                    if(cFn &amp;&amp; cFn != '')
                    {
                        if(typeof functionArguments == 'boolean' || functionArguments)
                            self[cFn]("ABORT", functionArguments);      //calling function by jquery Object notation    
                        else
                            self[cFn]("ABORT");
                    }
                }
                else if(errLabelCon.length == 2)
                // replaced removeLoadingMsg with blockUI so that   current loading should be remove not all
                       $(this).blockUI(false).cDialog(null,errLabelCon[0],errLabelCon[1],false,true,null,null,btnObject,false,null,false,"slide","center");
    },

        // ; Event will be called on Request Complete
        complete:function(XMLHttpRequest,textStatus){
                //; alert("Complete:  "+strResponseText+"  "+textStatus+" "+XMLHttpRequest);
                if(strResponseText.indexOf('Session Expired') != -1){
                    $(window.location).attr('href', 'Dashboard.action');
                }
                if(strResponseText=="System error")
                {
                    var btnObject = {
                            "OK": function(){$(this).dialog('close');}};
                    $(this).removeLoadingMsg().cDialog('customErrorDialog',sysErrorObj[0],sysErrorObj[1],false,true,null,null,btnObject,false,null,false,"slide","center");
                }
    }
    });
    //store the XHR object so that it can be used while ajax in progress
    $(this).data("xhr", xhrObj);
}
catch(e){
    var btnObject = {
            "OK": function(){$(this).dialog('close');},
            "Click to Login": function(){$(this).dialog('close');$(window.location).attr('href', 'LogonFwdAction.action');}};
    var exception = sysErrorObj[1];

    exception += "&lt;br /&gt;"+e;

    $(this).cDialog('customErrorDialog',sysErrorObj[0],exception,false,true,null,null,btnObject,false,null,false,"slide","center");
}
};
</code></pre>

<p>The problem is that after an ajax call is made in the setInterval the UI automatically gets unblocked for the next interval. But if I remove the ajax call in the setInterval the blockUI persists.</p>
