-3
I have the following jsp list where I just want to increment the value of the quantity field without refreshing the page.
The way I did, it works, but updates the page. So I searched, it would have to be by Ajax.
<table>
<tbody>
<c:forEach items="${revistas}" var="r">
<tr>
<td>${r.nome }</td>
<td>
<form id="testeForm" action="<c:url value="/atualizaQuantidade"/>" method="post" >
<input type="hidden" name="r.cod" id="cod" value="${r.cod}" />
<input type="hidden" name="r.qtd" id="qtd" value="${l.qtd}" />
<button type="submit" class="btn btn-primary">${r.qtd}</button>
</form>
</td>
</tr>
</c:forEach>
</tbody>
</table>
Since it’s a list, I have to get the id
of magazine, the amount in the list and send to my Java method to increment (this part I know how to do). Now do this via Ajax, I’m lost. Could you help me?
Where is the magazine ID?
– Sam
The magazine ID value gets through ${r. Cod}
– AmandaRJ
@Amandarj put an example, with the parameters of the form, if other, just inform.
– N. Dias