I have a While loop in my php that contains to get variables through POST with the serializeToJSON plugin.
It works in part, but it always takes the last result of the PHP loop with the inputs, when it should get all inputs from the loop, for example
I have this loop
<form>
<input type="hidden" name="id_i" id="id_i" value="<?php echo $id_i; ?>">
<input type="hidden" name="id_usuario" id="id_usuario" value="<?php echo $id_usuario; ?>"/>
<input type="hidden" name="auxiliar_fornecedor" id="auxiliar_fornecedor" value="<?php echo $produto["auxiliar"]; ?>">
<div class="number" data-last="<?php echo substr($produto ["telefone"], 6, 6); ?>"><i class="fa fa-phone" aria-hidden="true"></i> <?php echo substr($produto ["telefone"], 0, 6); ?><span><strong>Clique aqui para ver o número</strong></span></div>
</form>
The javascript will always take the last loop record How could I do that each time I click on the php loop's class div, I would send all the variables to the php file "my_ajax.php"?