Possible Duplicate:
Downloading Via JQuery AJAX Post not working
filedownload.php has below snippent.
$file = 'cut.png';
header("Content-Type: image/png");
header('Content-Disposition: attachment; filename="'.$file.'"');
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
readfile($file);
exit();
AJAX Call
jQuery.post('filedownload.php',{
'file' : result // not used for the time being
});
I make an ajax call to the filedownload.php file. It does not allow user to download the file. But If I run the php directly it allows user to download the file. What could be the issue ?
I would like to use core functions rather than using jQuery Plugins. If it’s not possible a plugin would be fine.
Given that I use ajax because the page can not be refreshed.
jQuery Code Which fixes the problem
How to call
Read more