The question is the following one, I am elaborating a project of degree I am doing sending of values stored in "hidden" inputs, but as they are different forms I want to try to make a single shipment, which sends me only the data of the form of the which was the action.
FORMS
<form method="post" data-toggle="GenerateTable">
<input type="hidden" value="<?php echo "01";?>" data-id="tableGenID">
<input type="hidden" value="<?php echo "colaborators";?>" data-role="tableGenType">
<button type="submit" class="btn btn-primary p-1" data-toggle="modal" data-target="#EditModalCenter">
<i class="material-icons table-icon-options">
edit
</i>
</button>
</form>
<form method="post" data-toggle="GenerateTable">
<input type="hidden" value="<?php echo "01";?>" data-id="tableGenID">
<input type="hidden" value="<?php echo "inventory";?>" data-role="tableGenType">
<button type="submit" class="btn btn-primary p-1" data-toggle="modal" data-target="#EditModalCenter">
<i class="material-icons table-icon-options">
edit
</i>
</button>
</form>
Send php document.
$('form[data-toggle="GenerateTable"]').submit(function(){
$.post('../../libs/TableGenerator.php',
{
tableId: $('input[data-id]').val(),
tableType: $('input[data-role]').val(),
},
function(Table_answer){
$('#ContentTableGenerator').append(
$('#ContentTableGenerator').add(Table_answer.GenerateTable)
);
}, 'json');
return false;
});
My problem is that I only take the values of the first Input "hidden" in the send;