有个AJAX问题,请教一下

Events happening in the community are now at Drupal community events on www.drupal.org.
GloolsGuan's picture

Drupal7默认的AJAX组建全部是基于form的。如果你的客户端AJAX需求与form无关,这种情况,大家是强行用Drupal.ajax 的命令response模式解决,还是自己建立ajax对象,脱离Drupal.ajax.

如果是后者,有什么便捷的方法或惯例吗?

Comments

我是直接使用 JQuery.ajax() ,很方便。

hooface's picture

我是直接使用 JQuery.ajax() ,很方便。

可以参考Drupal 7 中使用 JQuery 和 Ajax
这篇文章虽然有Form, 其实不要 Form 也是可以的。这里没有使用 Drupal 7封装的Ajax。

drupal 对ajax link支持非常友好,

rogical's picture

drupal 对ajax link支持非常友好, 只需要加上 ‘use-ajax’ class, 当然还有ajax库drupal_add_library('system', 'drupal.ajax');, 就可以实现link的ajax。

例子有:
ctools模块里自带的ajax example
http://drupal.org/project/draggable_captcha 模块里有用到基于link的ajax刷新,非form

中国 - China

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week