0
I am using PHP with AJAX. I need to take a multiple Forms id and run a function in AJAX. I am passing the ids of the Forms like this :
<form id="formItem<?= $idItem ?>">
However, in Jquery I cannot get the id, each form has a different id. All on the same page. My AJAX:
$('#formItem').submit(function(e){
e.preventDefault();
var idProduto = $('#idProduto').val();
var precoProduto = $('#precoProduto').val();
var qtdeCompra = $('#qtdeCompra').val();
$.ajax({
url: 'http://localhost/fcgeti_bairrojuventude/loja2/inserir.php',
method: 'POST',
data: {idProd: idProduto, precoProd: precoProduto, qtdeProd: qtdeCompra},
dataType: 'json'
});
getItens();
});
If you can help me. I’ve tried concatenating but it didn’t work.
Thank you
qnd I can’t get id of any element I try to do this before submitting the ajax request, to debug and check any error with the browser console opened to display any error and already inside the javascript code placed: `Alert( $('#id_que_eu_quer0').val()+'/ '+ $('#id_seguinte').val()); // if there is an error you will see in the console if any element is returning Undefined or another value....
– Sidclay Ataíde