I am using SPring mvc 3 with Thymeleaf.I have a list in my jsp page and each row in the bean is accompanied by a button.When I click on that button I want to get the index of that row.I am not able to do so.
I have the following list in my Jsp page
<tr th:each="idBean : ${idBeanLst}" >
<td th:text="${idBeanStat.count}" id="count"></td>
<td th:text="${idBean.identifierId}" id="idenId"></td>
<td th:text="${idBean.idNumber}" id="idNumber"></td>
<td th:text="${idBean.issueLocation}" id="issueLocation"></td>
<td th:text="${idBean.issueDate}" id="issueDate"></td>
<td th:text="${idBean.expiryDate}" id="expDt"></td>
<td>
<td>
<button type="button" name="identifierRow" id="identifierRow" th:value="${idBeanStat.index}" onclick="doAjaxCallRemoveIdentifier()">Remove</button>
</td>
function doAjaxCallRemoveIdentifier() {
alert('in here');
var idNumber = $('#idNumber').val();
var issueLocation = $('#issueLocation').val();
var issueDate = $('#issueDate').val();
var expiryDate = $('#expiryDate').val();
var identifierRow = $('#identifierRow').va();
alert(identifierRow);
var url = '/SpringUI/spring/removeIndentifier/';
$("#content").load(url, {
'identifierRow' : identifierRow
}, function () {
$('#idNumber').val('');
$('#issueLocation').val('');
$('#issueDate').val('');
$('#expiryDate').val('');
});
}
How can I send the index number of this arraylist indside the function doAjaxCallRemoveIdentifier().How can I do that?