Jquery File download ($.fileDownload)

后端 未结 5 754
清酒与你
清酒与你 2021-02-06 04:52

I am using jquery file download ..

the code is as follows :

 function downloadFile(){
var downloadOptions = {
preparingMessageHtml: \"We are preparing y         


        
5条回答
  •  南方客
    南方客 (楼主)
    2021-02-06 05:47

    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..

提交回复
热议问题