我有一个g:select
带有 onchange 事件的事件,它触发了一个调用请求方法的 remoteFunction,但是,回调 JS 函数没有被调用。
这是 g:select:
<g:select id="categories"
name="categories"
from="${Category.findAll('from Category where master is null')}"
noSelection="['':'- Selecione -']" optionKey="id" optionValue="description"
onchange="${remoteFunction(
controller: 'event',
action: 'subCategoriesJSON',
params:'\'id=\' + escape(this.value)',
onSuccess: 'updateSubs(data,textStatus)'
)}"
/>
subCategoriesJSON也被调用,但在updateSubs函数之后无法调用 remoteFunction 。我的页面在 head 标签上正确呈现了函数的范围。
这是功能:
<script type="text/javascript">
$(document).ready(function() {
function updateSubs(data, textStatus) {
alert('call me!!!');
var subs = eval("(" + e.responseText + ")");
if (subs) {
$("span#saida").html(subs);
}
}
});
</script>
任何线索都将受到欢迎。非常感谢!