mardi 29 décembre 2015

failed to download pdf in laravel 5

My code is like this :

<a href="javascript:;" onclick="showAjaxPdf('{{ $row->file_path }}');"><i class="fa fa-file-pdf-o"></i></a>

My javascript code is like this :

  function showAjaxPdf(file_path){
//example : file_path = assets/images/myfile.pdf
                $.post("news/test", { file_path: file_path } ); 
            }

My function test in controller :

 public function postTest(Request $request)
        {  
$file_path = $request->input('file_path');
            return response()->download($file_path);       
        }

When I click on the pdf icon, no response

I wish, when click on the pdf icon, appear like this: enter image description here

Thank you



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1OYhuDo
via IFTTT

Aucun commentaire:

Enregistrer un commentaire