This is link_to_remote code for rails 2.3.8
link_to_remote "Click here",
:update=>'flowtracker', :with=>"'topcount='+$('topcount').value, :url=>{ :controller => 'sessions', :action => 'session_for_tracker', :layout=>1 }
link_to_remote deprecated in rails 3
so 开发者_JAVA技巧how can i specify the :with attribute in link_to rails 3 And i'm using prototype.jsUse link_to
helper with :remote => true
option and do whatever you want in your js view file to your action.
EXAMPLE
in view:
<%= link_to 'ajax call', :controller => "sessions", :action => "session_for_tracker", :remote => true %>
in controller:
def session_for_tracker
@topcount = 1000; #get actual value here
respond_to do |format|
format.js
end
end
in js view for action:
page << %|
$('flowtracker').update("#{@topcount}");
|
精彩评论