Reputation: 169
<script type="text/javascript">
jQuery(document).ready(function() {
fnSelGrp = function(id, nm, exp){
$('#A').val(id);
$('#B').val(nm);
$('#C').val(exp);
$.ajax({
type: "GET",
url: "${innovativepot}/sysMng/codeList",
async: false,
data: "cdGrpId="+id,
success: function(result){
$('#codeList').html(result);
},
error: function(result, status, error){
alert('<spring:message code="data.error"/>');
}
});
.
.
.
.
<c:forEach items="${resultList.content}" var="result" varStatus="status">
<tr>
<td><input type="checkbox" id="chkGrp" name="chkGrp" value="${result.A}"/></td>
<td style="cursor:pointer;" onclick="fnSelGrp('${result.A}', '${result.B}', '${result.C}')">${result.A}</td>
<td>${result.B}</td>
<td>${result.C}</td>
</tr>
</c:forEach>
So I understand that this displays a chart with checkbox one the left. And it displays A,B,C from the "resultList.content". But here are my questions.
1) what does
<td style="cursor:pointer;" onclick="fnSelGrp('${result.A}', '${result.B}', '${result.C}')">${result.A}</td> mean?
2) In this code,
fnSelGrp = function(id, nm, exp){
$('#A').val(id);
$('#B').val(nm);
$('#C').val(exp);
what does it mean? Value of A becomes id? And it displays its data in #CodeList, correct?
Upvotes: 0
Views: 45
Reputation: 11579
1) Values ${result.A}, ${result.B}, ${result.C}
will be passed into JS
function when you click specified TD
. fnSelGrp
function will be called.
2) $('#A').val(id);
- the value of html element with id = "A"
will be set = id
. In your case id
will equal ${result.A}
. Result of ajax call (as HTML output) will be passed into #CodeList
element.
Upvotes: 1