How much JavaScript do you need to write to create Ajax applications from Rails?
What is the difference between form_tag
and form_remote_tag
?
What helper method lets you place identifiers on data on a per-record basis?
How do you include the Prototype and Script.aculo.us JavaScript libraries in your pages?
Which object lets you create JavaScript using Ruby in RJS pages?
You can create a basic Ajax application using Rails without writing any JavaScript directly. If you want to do complex things in the browser, though, you may find it easier to write some JavaScript.
form_tag
issues an HTTP
request that replaces all the content in the browser. form_remote_tag
issues an HTTP request,
but processes the results with JavaScript rather than having the
browser render them directly.
The dom_id
helper lets you put identifiers into HTML documents
and reference them from your server code as well.
Putting <%=
javascript_include_tag :defaults %>
into a view will
load the Prototype and Script.aculo.us JavaScript libraries into
the resulting HTML document.
The page
object is the bridge between Ruby and JavaScript
code.