My form is a payment gateway integration form. I need to save details to the database first, then only need to send the details to the payment gateway. When I submit the form I need to check it's validity with some php operation. After doing the php operation I need to actually submit the form.
Can you suggest a good method to solve this?
This is my form
<form method="post" action="paymentgatway url " id="myForm">
<input type="text" name="name1" requried>
<input type="text" name="cash" requried>
<input type="submit" name="submit1" id="submit1" value="submit">
</form>
and PHP
var $myForm = $('#myForm');
if ($myForm[0].checkValidity()) {
<?php some php code ?>
then submit the form
}
else{
$myForm.find(':submit').click();
}