My html 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)
{
var file_path = file_path.replace(/\\/g,"/");
//example : file_path = assets/images/myfile.pdf
$.ajax({
type: "POST",
data: 'file_path=' + file_path,
url: "news/test",
success: function(response)
{
$('#test').html(response);
}
});
}
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:
how to keep the current click pdf icon, the image appears like it?
Thank you
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire