var htmlContent=""; htmlContent=$('#table').html(); $("#htmlText").val(htmlContent); document.getElementById("form1").action="localhost/railtech/dynamic_pdf.php"; document.getElementById("form1").submit();