I am doing project with jquery mobile framework using zend framework.I have the page to download report in csv format. I can downloaded it from desktop version. But the same page in mobile version runs in ajax due to jquery mobile result undefined
with blank page
.
for example, i call this http://www.test.com/report/downloadtransaction when i click download button. This calls downloadtransactionAction in reportcontroller ,then finally gives csv file. Call is happening in mobile version but not able to see download file window.
Below is the code
public function downloadtransactionAction(){
$preview_result = getmySessionData('preview_result')->preview_key;
//print_obj($preview_result);
$myFile = "TRANSACTION_" . time() . ".csv";
header("Content-Disposition: attachment; filename=\"$myFile\"");
header("Content-Type: application/vnd.ms-excel; charset=UTF-16LE");
$out = fopen("php://output", 'w');
//$csvData = array('Warehouse Id', 'Name','Item No','Minimun Stock','Current Stock');
$csvData = array('No','DATE','USER', 'TRADE TYPE','AMOUNT');
$o = fputcsv($out, $csvData, ',', '"');
$count = 1;;
foreach($preview_result as $key => $value)
{
$csvData = array();
$csvData = array($count,date('Y/m/d',strtotime($value['date'])),$value['current_admin_name'],($value['trade_type'])?'WithDraw' : 'Deposit',$value['amount']);
$o = fputcsv($out, $csvData, ',', '"');
$count++;
}
fclose($fh);
// DOWNLOAD CSV
echo $out;
die;
}
I need to download csv in mobile version as like in desktop version What i done wrong on this ?