javascript on a partial - ruby on rails

I have a partial that gets loaded every 3 seconds using AJAX (Prototype framework), this way: this is the part of the controller that loads the partial: respond_to do |format| format.js {render(:partial => 'content', :locals => {:content => @last_shout.content})} end this is the content of the partial "_content.html.erb" :

<%= content %>

So far everything works great. I want to add, that every time the partial will be reloaded, it will be fadeIn using Scriptaculous framework. I added this code to the _content.html.erb partial: The problem was that instead of executing the code every time the partial gets reloaded, it executed it only one time. What do I need to do on order to make javascript code execute every time the partial gets loaded ?

以上就是javascript on a partial - ruby on rails的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏