I'm creating a couple of pdf invoices and want to merge them into one for easier printing after they've been created. I have this jquery code:
$('#printinvoice').click(function(){
$.ajax({
type:"POST",
url: "../ajaxcalls/print_invoice.php",
data: {
Order: itemstotake1
},
dataType:"json",
success: function(data) {
$.ajax({
type: "POST",
url: "../ajax/pdf_merger.php",
data: {
PDFS: data
},
success: function (data1) {
alert(data1);
//window.location.assign('../tools/PDFMerger/samplepdfs/TEST2.pdf');
$('.group').removeClass('highlight');
itemstotake1 = [];
}
});
}
});
});
I use PDFMerge, the Files are merged, but there is no response of my second success function. Here's the PHP code (pdf_merger.php)
include '../tools/PDFMerger/PDFMerger.php'; $files = $_POST['PDFS'];
$pdf = new PDFMerger;
$pdf->addPDF('../tools/PDFMerger/samplepdfs/three.pdf', 'all')
->addPDF('../tools/PDFMerger/samplepdfs/three.pdf', 'all')
->addPDF('../tools/PDFMerger/samplepdfs/three.pdf', 'all')
->merge('file', '../tools/PDFMerger/samplepdfs/TEST22.pdf');
When commenting from $pdf->addPDF
, the success alert pops-up(and the window.location).
Can someone tell me what I'm doing wrong?
Thank you!