I have form in website.php file. After user submits form I want to start download PDF with user data by mPDF extension. However when user submits form nothing happens. Only some gibberish appears in browser console.
The form data is sent to website.php using jquery's $.ajax() function. The formData is recieved in PHP, but the download won't start. Instead I recieve console full of mPDF's data. Now I don't care about user's formData, I just want to make mPDF's download work.
My PHP code in website.php:
if(array_key_exists("formData", $_POST)) {
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<h1>Hello world!</h1>');
$mpdf->Output('MyPDF.pdf', 'D');
}