如何让 link_to_remote 与 jQuery 一起工作? Ajax未定义错误

发布于 2024-09-08 17:50:50 字数 315 浏览 4 评论 0原文

我正在将 Ruby on Rails 与 jQuery 结合使用,并尝试执行以下操作:

    <%= link_to_remote (image_tag("delete.png"),  :url => { :action => 'remove_candidate', :id => candidate }) %>

当我加载页面并点击链接时,我在 FireBug 控制台中收到“Ajax 未定义”错误。 我知道这是因为我没有加载原型,而是加载了 jQuery 库,但是 那么我应该如何将它与 jQuery 一起使用呢?

I'm using Ruby on Rails with jQuery and trying to do the following:

    <%= link_to_remote (image_tag("delete.png"),  :url => { :action => 'remove_candidate', :id => candidate }) %>

When I load a page and hit the link I get 'Ajax is not defined' error in FireBug console.
I understand that it's because I didn't load prototype, but load jQuery libs instead, but
how I should use it with jQuery then?

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

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

发布评论

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

评论(1

尬尬 2024-09-15 17:50:50

使用 jrails 。这将为您定义所有这些助手。

Use jrails . That will define all these helpers for you .

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