2011-01-07 126 views
0
<%= link_to_remote "See more", :url => { :action => "aajax_activity", :page_current => (@page_current.to_i + 1), :user_id=>@sampleuser_profile.id }, :update => "sbottom_activity_#{@page_current.to_s}", :position => :before %> 

工作時轉換這link_to_remote在軌道3 LINK_TO不工作的link_to與遠程真不導軌3

<%= link_to "See more" , :url => { :action => "aajax_activity", :page_current => (@page_current.to_i + 1), :user_id=>@sampleuser_profile.id }, :update => "sbottom_activity_#{@page_current.to_s}", :position => :before ,:remote=>true %> 

什麼想法?

+0

它不起作用?你有什麼錯誤等? – Heikki 2011-01-07 11:28:42

回答

2

原因似乎是缺少jQuery庫。在Rails 3中,如果缺少jquery_ujs.js(用於jQuery的不引人注意的腳本適配器),就會發生這種情況。它添加到默認JavaScript文件config/application.rb,例如通過

config.action_view.javascript_expansions[:defaults] = %w(jquery jquery_ujs) 

或在您的layout.rb

javascript_include_tag :defaults, "jquery_ujs.js" 
0

下面的鏈接應該工作

<%= link_to "See more" , :url => { :action => "aajax_activity", :user_id=>@sampleuser_profile.id },:remote=>true, :method => :post %> 

要更新數據,您必須在文件中寫入JavaScript代碼aajax_activity.js.erb

相關問題