【发布时间】:2015-06-08 19:29:39
【问题描述】:
我有两组单选按钮,第一组代表尺寸,第二组代表数量和价格。
当更改尺寸收音机已更改时,我正在尝试使用 Ajax 更新数量旁边的价格。
到目前为止我所拥有的。
<script>
$(document).ready(function(){
$("input[name*='size']").click(function() {
${remoteFunction(
controller:'product',
action:'ajaxSize',
params:'\'size=\' + this.value')}
})
});
</script>
<g:formRemote name="myForm"
url="[controller:'product', action: 'save']" update="updateMe">
<input type="radio" name="size" value="2x2">2x2<br>
<input type="radio" name="size" value="4x4">4x4<br><br>
<input type="radio" name="quantity" value="15">15 ${price}<br>
<input type="radio" name="quantity" value="16">16 ${price}<br>
<input type="radio" name="quantity" value="17">17 ${price}<br>
</g:formRemote>
控制器
def ajaxSize = {
println params
render params
}
@Transactional
def save(Product product) {
}
【问题讨论】: