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", { name: file_path } );
}
My function test in controller :
public function postTest($file_path)
{
return response()->download($file_path);
}
When I click on the pdf icon, failed to send parameter from javascript to controller
I wish, when click on the pdf icon, appear like this: https://i.stack.imgur.com/s1VFw.jpg
Thank you