Click here to Skip to main content
15,846,211 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am using tcpdf php library to generate pdf documents. I need to specify an html element in the page to generate pdf document using jQuery and ajax. Here is ajax_test.php code:
$pdf = new TCPDF();
//$pdf->Cell(190, 10, 'Hello world!', 1, 1, 'C');

Now this is table.php code:
<h2>HTML Table</h2>
<p>Hello world!</p>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Centro comercial Moctezuma</td>
    <td>Francisco Chang</td>
    <td>Ernst Handel</td>
    <td>Roland Mendel</td>
    <td>Island Trading</td>
    <td>Helen Bennett</td>
    <td>Laughing Bacchus Winecellars</td>
    <td>Yoshi Tannamuri</td>
    <td>Magazzini Alimentari Riuniti</td>
    <td>Giovanni Rovelli</td>

I need when I press the pdf button download ONLY the table without refreshing the page using jQuery and ajax.

What I have tried:

How can I do this? Is there a way of doing this?
Updated 6-Sep-22 19:58pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900