I have a form and inside this form I am adding a certain input
dynamically via jquery
using a button, these inputs go to array
in a C # controller.
CurrentlyI'mdoingthis:
for(varj=0;j<numeroDePiscinas;j++){formdata.append("Piscinas", $("#piscina"+j).val());
}
The problem is that this logic will not work anymore because the user will be able to
you can remove these inputs, I used the Id
of the input of acorodo that was added, ex posição 1
, id=piscina1
What I want to do is to get all inputs with class inputPiscina
and send its value to the controller, I tried something like this:
$("#form:formPiscina").each(".inputPiscina",
function() {
formdata.append("Piscinas", $(this).val());
});
But it did not work, so anyone can help me, if anyone knows some better way to do this, I'd be grateful.