<form id="pdfform" target="_blank"> <input type="hidden" id="bill_id_pdf" name="bill_id_pdf"> </form> <script> function exporttopdf_common(bill_id) { $("#bill_id_pdf").val(bill_id); document.forms['pdfform'].action = "bill_form_pdf_invoice.php?bill_id=" + bill_id; document.forms['pdfform'].method = "post"; document.forms['pdfform'].submit(); } </script>