I have an AJAX call on the page create_pdf.php:
$('body').on('click', '.PrintButtonWithClass', function (event) {
var1 = $('#id1').val();
var2 = $('#id2').val();
dataString='var1='+var1+'&var2='+var2+'&pdf_name=PdfName&pdf_creator=myname';
$.ajax({
type: 'post',
url: '/path/to/createpdf/file/create_pdf.php',
data: dataString,
success: function (data) {
alert('success');
}
});
});
Q create_pdf.phpI tried to use this line to upload a file:
$pdf->Output(str_replace(' ','_',utf8_decode($_POST['pdf_name'])).'.pdf', 'D');
I also tried the options FDand Iwithout success, the file does not load.
How can I force a file created without saving it to a web server and not redirect the user to any other page? I want it to stay on the same page, and that the browser opens (for downloading or viewing a dialog box) for the PDF. Is there any way to do this?
EDIT: create_pdf.php expects POST variables. and uses them to create HMTL for pdf.