在 remoteFunction 和 remoteLink 标记中,可以列出要随服务器响应更新的元素映射。调用完成后,这些元素将被更新。
使用 jquery,可以将哪个事件处理程序绑定(bind)到元素以确定已发生对元素的更新?
谢谢
最佳答案
为什么不直接使用 g:remoteFunction 的 onComplete 属性呢?无论您在remoteFunction 或remoteLink 标记的onComplete 属性中指定什么javascript,都将在请求完成和更新完成后执行。然后,您可以放入该函数以进行所需的 jQuery 调用
<g:remoteFunction action="show" id="1" update="someElement" onComplete="callMe()" />
<script>
function callMe() {
// Do your jQuery stuff here. Elements have been updated on the page.
}
</script>
如果您需要知道成功或失败,您可以使用标签的 onSuccess 或 onFailure 属性。
有关更多信息,请参阅 grails 文档中的此页面:http://grails.org/doc/latest/ref/Tags/remoteFunction.html
关于jquery - grails,哪个 jquery 事件处理程序绑定(bind)到由 remoteFunction 或 remoteLink 进行的元素更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7804022/