javascript - PHPExcel Download and JS returns on form.submit -


i'm calling php script genereta excel file , download on fly

 header('content-type: application/vnd.ms-excel');  header("content-disposition: attachment;filename=iva.xls");  $objwriter = new phpexcel_writer_excel5($objphpexcel);   $objwriter->save('php://output'); 

after code finish with:

 $areturn[]= array('result'=>true);  exit(json_encode($areturn)); 

at first moment start calling php using submit button... (trying progress bar) decided call php using javascript following code:

 $.messager.progress();     var urlprotax="taxes/processtax.php?start=" + cstartdate + '&end='+ cenddate ;    $('#taxesform').form('submit',{          url: urlprotax,          onsubmit: function(datt){              var isvalid = $(this).form('validate');              if (!isvalid){                                             $.messager.progress('close');                                       }              return isvalid;          },          success: function(jdatos){              alert('alert data '+ jdatos);              data = eval('('+jdatos+')');              if(data[0]['result']===true){                  $.messager.progress('close');                  $('#taxeswin').window('close');                   return true;              }else{                  $.messager.progress('close');                  var iderror = data[0]['error'];                  $.messager.alert("error (" + iderror +")" , gt.gettext('unknown error'), 'error');                   $('#taxeswin').window('close');              }          },          error: function(xhr) {          alert('error! status = ' + xhr.status);}   }); 

excel file being created fine!!! never json response close progress bar.

kind regards,

excel files binary, json doesn't support binary formats directly. might have better luck if use ascii format csv


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -