画面遷移しないでファイルダウンロード
サーバーから適切なContent-typeを指定してあげれば、location.hrefの設定のみでよい。
php
header('Status: 200 OK'); header('Content-type: application/octet-stream'); header('Content-Disposition: attachment; filename="hoge.txt"'); // ファイル名
javascript
$('#btn").click(function(){ location.href = 'download_page.php' ; }) ;