In most cases, the eligible DOM elements are identified by HTML5
data attributes.
using JavaScript to progressively
enhance the user experience for capable browsers without negatively impacting
clients that do not support or do not enable JavaScript.
jquery-ujs attaches a handler to links with the data-method attribute
When the link is clicked, the handler constructs an HTML form along with a hidden input that sets the _method parameter to the requested HTTP verb
jquery-ujs attaches a handler to links or forms with the data-confirm
attribute that displays a JavaScript confirmation dialog
Users double click links and buttons all the time.
Links and buttons that
have a data-disable-with attribute get a click handler that disables the
element and updates the text of the button to that which was provided in the
data attribute and disables the button.
If the action is performed via AJAX,
the handler will re-enable the button and reset the text when the request
completes.
Thanks to
jquery-ujs and Rails’ respond_with, setting remote: true is likely the
quickest way to get your Rails application making AJAX requests.
support both AJAX and standard
requests at the same time.
Cross-Site Request Forgery (CSRF) is an attack wherein the attacker tricks the
user into submitting a request to an application the user is likely already
authenticated to.
"the reason to use the bar is because you're switching content via JavaScript rather than loading a new page. This makes sense since the browser's own loading indicator may not get triggered. "