Hello I've got a problem with my page, cuz I want to generate PDF file async with jquery, command:
$(".btn").click(function(){
$.get('/pl/home/generujPDF', function( data ) {
});
In my controller it looks somethink like this
function generujPDF()
{
require_once 'vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<h1>Hello world!</h1>');
$mpdf->Output("mpdf.pdf", "D");exit;
}
And that doesn't work, But if I type in URL /pl/home/generujPDF it just work fine. I check how it looks in "Network" tab in browser and I have 2 other types of this URL- ... document (working fine) and xhr(it doesn't work) Network Tab How to fix that, Thank you in advance :)