grails,jquery 事件处理程序绑定到由remoteFunction 或remoteLink 进行的元素更新

发布于 2024-12-10 12:06:32 字数 132 浏览 1 评论 0原文

在remoteFunction 和remoteLink 标签中,我们可以列出要随服务器响应更新的元素映射。当调用完成后,这些元素将被更新。

使用 jquery,哪个事件处理程序可以绑定到元素来确定元素已发生更新?

谢谢

In the remoteFunction and remoteLink tags one can list a map of elements to update with the server response. When the call is done, these elements will be updated.

Using jquery, which event handler can one bind to the element(s) to determine that an update to the element has occurred?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

睡美人的小仙女 2024-12-17 12:06:32

为什么不直接使用 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

Why not just use the onComplete attribute of g:remoteFunction? Whatever javascript you specify in the onComplete attribute of the remoteFunction or remoteLink tag will be executed upon completion of the request and updates being finished. You can then put in that function to make the jQuery calls you want

<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>

If you need to know success or failure, you could use the onSuccess or onFailure attributes of the tag.

See this page in the grails docs for more info: http://grails.org/doc/latest/ref/Tags/remoteFunction.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文