Reputation: 4174
In this code the Id & Name values are get correctly but in link the value id not in format
function onStudentDivisionChange() {
$.ajax({
type : 'POST',
dataType : 'json',
url : '/sample/selectDivision.html',
data : ({
id : $('#division').val()
}),
success : function(responseData) {
if (responseData != null) {
$('#student').find('td').remove().end().append('').val('-1');
$.each(responseData, function(index, item) {
$('#student').append(
$('<td></td>').val(item['id']).html(item['id']),
$('<td></td>').val(item['id']).html(item['name']),
$('<td></td>').val(item['id']).html(
'<a th:href="@{/teacher/edit.html(id=${id})}" >Edit</a>'),
$('<br />').val(item['id']).html(item['']));
});
} else {
$('#stud').find('td').remove().end().append('<td th:text="${student}"></td>').val('-1');
}
}
});
}
Problem was in the
`<a th:href="@{/teacher/edit.html(id=${id})}" >Edit</a>`
^
|__ value of Id is get as id in alphabet. = id
Not the student id number or Integer
The value of id can not get here..
i don't know this is right . if any one know about this please share here..
Upvotes: 0
Views: 135
Reputation: 3047
Try the following :
'<a th:href="@{/teacher/edit.html(id=${' + item['id'] + '})}" >Edit</a>'
This will append in the value of ID from the item object.
Upvotes: 1