vendredi 3 décembre 2021

How to enable / disable a waiting layer before/after a request?

I´ve got a function called exportGraph() which download an Excel file, I want to show a waiting-layer until download is done. When this job is done I want to remove that hiding-layer.

I have both methods already coded show~hideWaitingLayer(), but now How do I trigger removing waiting-layer when the download is finished?. Thanks.

function exportGraph() {

        var params = "?methodValidation=validation&baseFilterDto.dateStart="+$('#dateStart').val();
        params = params + "&baseFilterDto.dateEnd="+$('#dateEnd').val();
        if (0 < $('#cmbGroups').val()) {
            params = params + "&baseFilterDto.codElement="+$('#cmbGroups').val();   
        }   

        window.location="<%=context%>/queryExportAction.do"+params+'&csrf=' + $csrf; 
        showWaitingLayer();
        // does not hide automatically
        /*
         $(window).blur(function() {
                hideWaitingLayer();
        });
        */
 }      



Aucun commentaire:

Enregistrer un commentaire