mardi 29 décembre 2015

failed to send parameter from javascript to controller 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", { 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: http://ift.tt/1IChlsz

Thank you



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

Aucun commentaire:

Enregistrer un commentaire