I am trying to download file through ajax request. I have below code in my php file to dowload
$filedata="File data here"
header("Content-type: application/octet-stream");
header("Content-Disposition:attachment; filename=report.txt");
header('Content-Transfer-Encoding: binary');
header("Pragma: public");
header("Expires: 0");
echo $filedata;
It giving me ajax response but not providing file download dialog box. Is any solution? Thanks in advance.