I have two different pages that serve separate functions.
When a button is clicked, data is posted to the database through finalizecontract.php
. contract.php
is a TCPDF form that uses the data from the database to fill out and generate the signed version of the contract, and saves the PDF file to a folder on my server.
I already tested and verified that the output works properly. I'm trying to figure out how to run contract.php
when the Finalize Contract button is clicked. I attempted to use $.get
but it's not working (or I have it in the wrong place).
What is the proper method of posting the data to the database, then calling the TCPDF file to save the contract in a PDF form?
<script type="text/javascript">
function finalizecontract() {
// Add record
$.post("ajax/finalizecontract.php", {
uuid: $("#c_uid").val(),
}, function (data, status) {
if(data != "Success")
{
alert(data);
$.get('contract.php');
}
else
{
$("#finalize_contract_modal").modal("hide");
location.reload(true);
}
});
}
</script>