Rectangle 27 0

javascript Opening the PDF file onclick of a button with AJAX?

    <input id='$idd' type='button' value='View PDF'class='btn btn-primary' onclick='viewPDF(' target='_blank' >
<div id="pdfResult"></div>

function viewPDF(id){  
    $.ajax({  url: "viewCrf.php",
        data: {'idd' : id},
        type: "POST",
        success: function (data) {
header("Content-type: application/PDF");

Anyway, I found the answer :). I just used GET METHOD and change the button into an href.

Check the Dest parameter of output(). It is I by default... It looks like you specified S... as for "string".

I didn't put anything inside the Output(). Yet it still returning the above picture.

Since using FPDF, you certainly have some PHP code looking like this.

Still not showing anything. I edited my post and added an image of what the alert(data) is returning.