I need: 1) Get data from server by button click. (can ajax) 2) Execute some js dependi开发者_运维技巧ng on the received data. 3) Show standard "File save as" dialog.
It must work in IE7/IE8/FF.Thanks! And sorry for my crooked english =)
You can call a PHP file using ajax, which looks like this:
header("Content-Type: application/octet-stream");
header("Content-Length: " . filesize($fileContent));
header("Content-Disposition: attachment; filename=\"".$fileName."\"");
echo $fileContent;
This will display the "save as" dialog box in all browsers.
精彩评论