gpt4 book ai didi

jquery - 在 Rails 中从原型(prototype)切换到 jquery,助手呢?

转载 作者:数据小太阳 更新时间:2023-10-29 07:07:38 25 4
gpt4 key购买 nike

我目前从prototype切换到jquery主要是为了支持简单的ajax文件上传。我使用:https://github.com/indirect/jquery-rails

95% 的 javascript 代码是由 rails helper 编写的,例如:

- remote_function
- render :update do |page|
- page.replace_html 'id', :partial => 'content'
- page['form']['name'] = something
- page.visual_effect :highlight, 'head_success'
...

我知道我必须为 Jquery 重写 5% 的纯原型(prototype)代码,但其余的呢?我是否必须用原始 jquery 重写它?

我用:

  • rails 3.0.7
  • jquery-rails 1.0.7

最佳答案

所有的助手都被弃用了,取而代之的是不显眼的 javascript(不管是否你正在使用 jQuery 或 PrototypeJS)。

您可以在这里找到详细的指南:

http://www.simonecarletti.com/blog/2010/06/unobtrusive-javascript-in-rails-3/

关于jquery - 在 Rails 中从原型(prototype)切换到 jquery,助手呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6126247/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com