Drupal:如何将自定义 jQuery 函数绑定到某个 AJAX 响应?
我有一个由 AJAX 回调函数验证的 AJAX 表单。一切都是使用 Drupal API 完成的。但我不想在回调发生时使用附加/前置/替换 DOM 元素的标准机制。如何捕获 AJAX 响应并使用我的自定义函数对其做出反应?
I have an AJAX form which is validated by AJAX callback function. Everything is done using Drupal API. But I don't want to use standard mechanism of appending/prepending/replacing of DOM elements when callback happens. How to catch that AJAX response and react on it with my custom function?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试定义一种行为。在许多情况下,包括 AJAX 请求,Drupal 将调用“attachBehaviors”,这也会触发您的行为:
您必须检查和检查上下文以了解它是否是正确的上下文,您正在寻找什么
You can try defining a behavior. In many situations, including an AJAX request, Drupal will call to "attachBehaviors" that will trigger your behavior too:
You must check and inspect context to know if it's the right context what are you looking for