[eluser]Akinzekeel[/eluser]
If I understood you correctly, you could do it like this:
- Post your stuff to the controller via AJAX (jQuery javascript Framework offers easy handling of this)
- When the AJAX request is complete (i.e. when your data was inserted) run a javascript function which submits the form
Here's an example with jQuery. It will show the order summary and when your customer clicks "Place order" it will trigger your controller function which does some database insert. After that request is completed it will submit the actual <form> to a different controller function.
Code:
<script>
function doInsert() {
$.post("http://example.com/controller/function/", {myData1: "I am ready!", myData2: "some more data!"}, function(a,b,c) {
// this will execute AFTER your controller has finished execution and has delivered some output
document.myFormName.submit(); // submit the form
});
}
</script>
<p>Your order summery here...</p>
<button onclick="doInsert()">Place order!</button>
<form method="post" action="http://example.com/controller/myPaymentFunction" name="myFormName">
<input type="hidden" name="submitdata" value="some data for 2nd POST">
</form>