0

I have code to download excel file:

$("#downloadReportingTask").empty();
        $("#downloadReportingTask").html('Processing...');
        download = '<?php echo $this->baseurl; ?>/reporting/downloadTask' +
                '?taskGroupId=' + $('select[name="taskGroupId"] option:selected').val() +
                '&status=' + $('#filterStatus').val() +
                '&startDate=' + $('#startDate').val() +
                '&endDate=' + $('#endDate').val() +
                '&userId=' + $('#userIdList').val();
       window.location = download;

This is the result:
enter image description here
I want to check downloading file is completed or no. I tried on window.close:

if (window.close) { 
           $("#downloadReportingTask").empty();
           $("#downloadReportingTask").append('<i class="ace-icon fa fa-download"></i> Export To Excel');
       }

But window.close didn't work. Maybe there's some code to check file is downloaded or no. Help me please. Thanks

  • What were the symptoms that made you think it did not work. Please provide, as this might help to help you. Thanks. – Dilettant Jun 15 '16 at 09:47
  • `if(window.close)` is not working @Dilettant – Nike Yulistia Angreni Jun 16 '16 at 02:25
  • 2
    saying `if(window.close)` is merely checking the truthy value of that property. so if `window.close` is a function (which it should be) it will return true every time and immediately run that code. you need to `var newWindow = window.open(...)` then do a `newWindow.onclose = function () { /* do stuff here when closes... */ };` – Deryck Jun 16 '16 at 02:55

0 Answers0