method
remote_function
v1.2.6 -
Show latest stable
-
2 notes -
Class: ActionView::Helpers::PrototypeHelper
- 1.0.0
- 1.1.6 (0)
- 1.2.6 (0)
- 2.0.3 (11)
- 2.1.0 (0)
- 2.2.1 (0)
- 2.3.8 (0)
- 3.0.0 (5)
- 3.0.9 (-2)
- 3.1.0
- 3.2.1
- 3.2.8
- 3.2.13
- 4.0.2
- 4.1.8
- 4.2.1
- 4.2.7
- 4.2.9
- 5.0.0.1
- 5.1.7
- 5.2.3
- 6.0.0
- 6.1.3.1
- 6.1.7.7
- 7.0.0
- 7.1.3.2
- 7.1.3.4
- What's this?
remote_function(options)
public
Returns the JavaScript needed for a remote function. Takes the same arguments as link_to_remote.
Example:
<select id="options" onchange="<%= remote_function(:update => "options", :url => { :action => :update_options }) %>"> <option value="0">Hello</option> <option value="1">World</option> </select>
Register or
log in
to add new notes.
joni -
August 13, 2009
3 thanks
With multiple parameters
Example
remote_function( :url => some_remote_function_path, :with => "'key1='+$('elem_id').value +'&key2='+$('elem_id').value+ '&this_elem_value='+value" )
Vidmantas -
April 16, 2009
3 thanks
Example
This function can be used to pass the ID of selected item, for example:
# with select or collection_select helpers: { :onchange => remote_function(:url => { :action => 'do_smth' }, :with => "'id=' + $('the_id').value") } # and grab ID in controller action as usually: YourModel.find(params[:id])