【发布时间】:2014-03-27 07:12:43
【问题描述】:
<head>
<g:javascript library='jquery' />
<r:layoutResources />
<script type="text/javascript">
function getGroupsDetails(){
var selectedGroup = jQuery("#group").val();
if(selectedGroup != "")
${remoteFunction (controller: 'groups', action: 'details', params: '\'groupId=\' + selectedGroup', update: 'details')}
}
</script>
</head>
<body>
<div class="col-xs-12 col-sm-4">
<strong>By Group Name :</strong>
<g:select id="groups" name="groupName" from="${Groups.list()}" value="${groupsInstance?.id}" noSelection="['':'-Select-']" optionKey="id" onChange="getGroupsDetails();" />
<div id="details"></div>
</div>
</body>
</html>
具体动作如下
def details(){
println "in details"
def groupIns = Groups.get(params.id)
println groupIns.id
render(template: "details", model: [groupIns: groupIns])
}
现在它进入了 javascript 以及细节控制器。在控制器中,我也打印了 id。但在 gsp 中它什么也没显示...
【问题讨论】:
标签: javascript grails gsp