I try to make a pdf file in my laravel program then download it, but the problem is the file can not be downloaded. This is my code:
Ajax:
$("#get_laporan_bap").click(function(){
    //alert("masuk");
    var atas_nama       = $("#atas_nama").val();
    var token           = $("#token").val();
    alert(atas_nama);
    $.ajax({
        type: "post",
        data: "atas_nama=" + atas_nama + "&_token=" + token,
        url: "<?php echo url('/get_laporan_tolsis') ?>",
        success:function(data){
            console.log(data);
        }
    });
});
Controller:
public function get_laporan_tolsis(Request $req){
    $atas_nama  = $req->atas_nama;
    $tanggal    = \Carbon\Carbon::now()->toDateString() ;
    $nama_file  = "Laporan Tolsis[".$tanggal."].pdf";
    $data = DB::table('bap_tolsis')->select('*')->whereDate('tanggal_input', $tanggal)->where('status',"=",'belum')->get();
    $pdf    = PDF::loadView('laporan_tolsis',['data'=>$data]);
    return response($pdf->download($nama_file, array("Attachment" => false)));
}
I really have no idea to solve it. Help me guys, thanks.
