submit_to_remote如何加入insertion选项?

cat_hsfz 2008-07-13 09:21:38
我想用Rails服务器端的submit_to_remote,同时我希望能够好像在客户端用Ajax.Updater那样,可以使用insertion来让response text插入到指定元素的前面或者后面而非里面。这应该怎么做呢?
...全文
148 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
cat_hsfz 2008-07-26
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 taito 的回复:]

:position => :before  目标元素的起始标签之前
:position => :top    目标元素的最顶端,紧跟在起始标签后面
:position => :bottom  目标元素的最后,正好在结束标签之前
:position => :after  目标元素的结束标签之后

如:
<%=link_to_remote "Add to cart", :url => {:action => "adds"},:update => {:success => "cart", :failure => "error" },:position => :bottom
%>
[/Quote]

原来这东西在Rails里面叫:position,而且我在API Doc里面还看不到,汗……谢谢了,我试用一下,没问题就结贴。
kuailetianren 2008-07-25
  • 打赏
  • 举报
回复
顶一下
cat_hsfz 2008-07-22
  • 打赏
  • 举报
回复
我知道怎么在Rails里面使用Prototype,我的意思是Rails的submit_to_remote方法如何能够设置insertion选项?
taito 2008-07-22
  • 打赏
  • 举报
回复

:position => :before 目标元素的起始标签之前
:position => :top 目标元素的最顶端,紧跟在起始标签后面
:position => :bottom 目标元素的最后,正好在结束标签之前
:position => :after 目标元素的结束标签之后

如:
<%=link_to_remote "Add to cart", :url => {:action => "adds"},:update => {:success => "cart", :failure => "error" },:position => :bottom
%>
taito 2008-07-22
  • 打赏
  • 举报
回复

:position => :before 目标元素的起始标签之前
:position => :top 目标元素的最顶端,紧跟在起始标签后面
:position => :bottom 目标元素的最后,正好在结束标签之前
:position => :after 目标元素的结束标签之后

如:
<%=link_to_remote "Add to cart", :url => {:action => "adds"},:update => {:success => "cart", :failure => "error" },:position => :bottom
%>
redcn2004 2008-07-21
  • 打赏
  • 举报
回复
ruby没用过,支持你一下
taito 2008-07-21
  • 打赏
  • 举报
回复
做法是一样的。 在view的头中加入<%= javascript_include_tag :defaults %>,客户端即可使用 rails 自带的 ajax prototype

2,764

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ruby/Rails
社区管理员
  • Ruby/Rails社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧