Flowdock
method

submit_to_remote

Importance_2
Ruby on Rails latest stable (v4.0.2) - 0 notes - Class: ActionView::Helpers::PrototypeHelper

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.

submit_to_remote(name, value, options = {}) public

Returns a button input tag with the element name of name and a value (i.e., display text) of value that will submit form using XMLHttpRequest in the background instead of a regular POST request that reloads the page.

 # Create a button that submits to the create action
 #
 # Generates: <input name="create_btn" onclick="new Ajax.Request('/testing/create',
 #     {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form)});
 #     return false;" type="button" value="Create" />
 <%= submit_to_remote 'create_btn', 'Create', :url => { :action => 'create' } %>

 # Submit to the remote action update and update the DIV succeed or fail based
 # on the success or failure of the request
 #
 # Generates: <input name="update_btn" onclick="new Ajax.Updater({success:'succeed',failure:'fail'},
 #      '/testing/update', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this.form)});
 #      return false;" type="button" value="Update" />
 <%= submit_to_remote 'update_btn', 'Update', :url => { :action => 'update' },
    :update => { :success => "succeed", :failure => "fail" }

options argument is the same as in form_remote_tag.

Show source
Register or log in to add new notes.