I am using jquery file download ..
the code is as follows :
function downloadFile(){
var downloadOptions = {
preparingMessageHtml: \"We are preparing y
please try like this
function exportToExcelTest() {
var region = $('#ddlRegion').val();
var hrinfo = $('#hrinfodropdown').val();
if (region != null) {
$('#ExportOptions').modal('hide');
$.blockUI({ message: 'Please wait generating excel data...
' });
//$.blockUI({ message: ' Just a moment...
' });
$.blockUI({ css: { backgroundColor: '#f00', color: '#fff'} });
var myData = region + ':' + hrinfo;
$.fileDownload('Excel.ashx', {
httpMethod: "POST",
data: { data: myData },
successCallback: function (url) {
//$("div#loading").hide();
//alert('ok');
//response.setHeader("Set-Cookie", "fileDownload=false; path=/");
$.unblockUI();
},
prepareCallback: function (url) {
//alert('ok');
//response.setHeader("Set-Cookie", "fileDownload=true; path=/");
$.unblockUI();
},
failCallback: function (responseHtml, url) {
//alert('ok');
// $("div#loading").hide();
// alert('Error while generating excel file');
//response.setHeader("Set-Cookie", "fileDownload=false; path=/");
$.unblockUI();
}
});
}
else {
alert('Please select a region....');
return false;
}
}
Referance from : https://www.experts-exchange.com/questions/28713105/Jquery-fileDownload-successcallback-not-working.html
I hope it's Work for you..