Listing 2. index.rhtml (Ajax Version)
Sample HTML page
<%= javascript_include_tag 'prototype' %>
Headline
<%= submit_to_remote "submit-button",
"Pig Latin it!",
:url => { :action => "piglatin_sentence" },
:submit => "fakeForm",
:update => "headline" %>
]]>
We also have replaced our button with a call to the submit_to_remote
helper:
<%= submit_to_remote "submit-button",
"Pig Latin it!",
:url => { :action => "piglatin_sentence" },
:submit => "fakeForm",
:update => "headline" %>