Generate TCPDF with ajax call parameter

I have a post which has 3 extra custom text field and it has some content.now i have link on front and to popup that 3 fields content.When page load they are in display none mode but when i click link it opens in fancybox popup.Now i want to generate pdf of each file using tcpdf or any other easy way i am using tcpdf for my purpose but i get all 3 fields in single pdf so i use ajax when i click link it takes anchor tag value and pass to the pdf parameter via ajax but nothing seems to work here is my code for ajax call in single.php

<script type="text/javascript">
                                  jQuery(function($){ 

    $('nav a.cboxElement').on('click', function(){
        alert('hi');
        var nv = $(this).text().toLowerCase().replace(/s+/g, "_");
 alert(nv);
        $.ajax({
            type: "POST",
            url: '<?php echo get_template_directory_uri(); ?>/popupdatatopdf.php',
            data: {valueMin : nv}
        }).done(function(result) {
            alert(result);
            console.log(result);

        });
   });
});

</script>                             

Below code if for popupdatatopdf.php i can see hello printed and can can see hello123 in pdf but the data which i got via ajax request not printing in pdf i checked in console and i can see value of request there but it does not get prited i pdf

echo "hello";
$pdfname="uu";
$mlm=$_REQUEST['valueMin'];
$nn="hell0123";
$html3.="<div style='font-size:23px;'>".$mlm.$nn."</div>";  
$html3.="<div style='font-size:23px;'>ppc</div>";   

Related posts

Leave a Reply