I have a form whose method is POST:
<form action="/includes/process.php" method="post">
<input type="hidden" name="breakDown" value="1" />
<input type="hidden" name="string" value="2" />
<a href="javascript:;" class="btn btn-primary add-cart formSubmitCheckout">Checkout</a>
</form>
And this is the javascript that submits the form.
$('.formSubmitCheckout').click(function() {
var t=$(this);
var isItemCheckout = t.hasClass('itemCheckout');
var form = t.parents('form');
if(!isItemCheckout) {console.log('testOk');
form.submit();
}
});
The fact is that when you press the link that simulates a submit button the data is not being sent to process.php
, that is, the $_POST
array is not being created.
I've never been through this situation. Does anyone know what can it be? Pq $ _POST is not being generated or sent?
UPDATE:
I have this following test on process.php
if (isset($_POST['string'])) {
And doing a console.log($('form').serialize());
I can see the variable 'string' (the name of the variable is string) string=type%3Dpurchase%26priceAmo
.