PrototypeHelper
The Prototype JavaScript library simplifies many common Ajax tasks, but these helper methods make it even more convenient to incorporate calls to Prototype in Rails templates:
evaluate_remote_responseEvaluates the JavaScript response from a remote service using the JavaScript
evalmethod. Theevalmethod opens JavaScript applications up to attack, so be certain that what you’re processing is free of potentially harmful code.form_remote_forSame as
remote_form_for, described later.form_remote_tagCreates a
formelement that uses anXmlHttpRequestcall to submit form data. This allows the page to handle the response rather than reloading an entirely new page.link_to_remoteCreates a link that issues an
XmlHttpRequestcall, again allowing the page to handle the response rather than replacing the current page with a new destination.observe_fieldWatches the content of a given field and makes a remote call (or a JavaScript function call) when the content of that field changes. Useful for components like text fields that provide suggestions.
observe_formWatches the content of a given form and makes a remote call (or a JavaScript function call) when the content of that field changes.
periodically_call_remoteMakes an
XmlHttpRequestcall every so often, according to a duration specified in seconds set as the:frequencyoption.remote_form_forWorks like
form_for, except that submitting the form triggers anXmlHttpRequestcall that gets handled by Ajax in the browser instead of the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access