I'm Needing to submit div content from one page to my html2pdf conversions page. I was wanting to do this using jquery so I do not have to leave my home page to make downloadable PDF file. I found an online example but I can not seem to make it work right. Any help with this project would be appreciated greatly. Here's the code I found. I just want to pass my div content so I can create a downloadable PDF file. I don't need any error message return link this script contains. Thanks



home.php

[CODE]
<! DOCTYPE>
<html>
<head>
<title></ title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
src="js/jquery-1.9.1.min.js" <script type="text/javascript"> </ script>
<script type="text/javascript">
$ (Document). Ready (function () {
$ ("#exportentry"). Click (function (e) {
e.preventDefault ();
if (submitted) {
var data = $ ("#container"). html ();
var filename = "Entry_Report.pdf";
$. Ajax ({
type: "POST",
url: "convert.php",
data: {data: data, filename: filename}
dataType: "json",
success: function (data) {
alert ('success');
}
})
Else {}
alert ("No Report To Export");
}
});
});
</ Script>

</ Head>
<body>
<div id="container">
<center> <h3> Nations and Flags </ h3> </ center>
<table border="1" width="500" cellspacing="0" cellpadding="2" align="center">
<tr> <td> <% = Request.QueryString ("v")%> India </ td> <td width="200"> <img src = "imag / in-t.jpg" width = "48" height = "32"> </ td> </ tr>
<tr> <td> <% = Request.QueryString ("v2")%> Australia </ td> <td width="200"> <img src = "imag / as-t.jpg" width = "48" height = "32"> </ td> </ tr>
<tr> <td> Canada </ td> <td width="200"> <img src="imag/ca-t.jpg" width="48" height="32px" </ td> </ tr >
<tr> <td> China </ td> <td width="200"> <img src="imag/ch-t.jpg" width="48" height="32px" </ td> </ tr >
<tr> <td> Germany </ td> <td width="200"> <img src="imag/de-t.jpg" width="48" height="32px" </ td> </ tr >
<tr> <td> France </ td> <td width="200"> <img src="imag/fr-t.jpg" width="48" height="32px" </ td> </ tr >
<tr> <td> United Kingdom </ td> <td width="200"> <img src="imag/uk-t.jpg" width="48" height="32px" </ td> </ tr>
<tr> <td> United States of America </ td> <td width="200"> <img src="imag/us-t.jpg" width="48" height="32px" </ td> </ tr>
</ Table>

<table border="0" width="500" cellspacing="0" cellpadding="2" align="center">
<tr> <td align="center"> <a href = " http://www.scriptarticle.com "target =" _blank "> http://www.scriptarticle.com </ a> </ td> < / tr>
</ Table>
</ Div>
<form method="post" id="exportentry" action="home.php">
<input type="submit" value="Create PDF">
</ Form>
</ Body>
</ Html>
[/ CODE]



convert.php

[CODE]
<? Php

require ('html2fpdf.php');

if (isset ($ _POST ['data'])) {
Urlcontents $ = $ _POST ['data'];
$ Filename = $ _POST ['filename'];
$ Date = $ _POST ['date'];
convert ($ urlcontents, $ filename, $ date);
}

function convert ($ contents, $ name, $ currdate) {
$ Pdf = new HTML2FPDF ();
$ Pdf-> AddPage ();
$ Pdf-> SetFont ('Arial', 'B', 16);
$ Pdf-> Cell (40.10, "Report Entry");
$ Pdf-> SetFont ('Arial','', 12);
$ Pdf-> Cell (90.12, '-'. $ Currdate);
$ Content = strip_tags ($ contents, '<html> <body> <meta> <img> <h2> <h4> <div> <ul> <li> <span>');
$ Pdf-> Sety (20);
$ Pdf-> WriteHTML ($ contents);
$ Content = $ pdf-> Output ('', true);
$ File = fopen ($ filename, "D");
fwrite ($ file, $ content);
fclose ($ file);
}
?>
[/ CODE]