diff options
author | Dimitri Roche <dimroc@gmail.com> | 2017-10-13 09:05:12 -0400 |
---|---|---|
committer | Dimitri Roche <dimroc@gmail.com> | 2017-11-24 14:21:47 -0500 |
commit | a6b0930ff164701e208308d9c23e36e6d05d5ae2 (patch) | |
tree | 168ab0b7e1e398f21b9a3a6de5bd96b3617268b3 /guides | |
parent | d06a1ee7eec96a1b52f21026e18a0a09219e66a8 (diff) | |
download | rails-a6b0930ff164701e208308d9c23e36e6d05d5ae2.tar.gz rails-a6b0930ff164701e208308d9c23e36e6d05d5ae2.tar.bz2 rails-a6b0930ff164701e208308d9c23e36e6d05d5ae2.zip |
Update documentation to lead with ajax param `event.detail`
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/working_with_javascript_in_rails.md | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md index f8cfac3995..fc9d3d0ce3 100644 --- a/guides/source/working_with_javascript_in_rails.md +++ b/guides/source/working_with_javascript_in_rails.md @@ -198,8 +198,9 @@ $(document).ready -> Obviously, you'll want to be a bit more sophisticated than that, but it's a start. -NOTE: As of Rails 5.1 and the new `rails-ujs`, the parameters `e, data, status, xhr` -have been bundled into `event.detail`. +NOTE: As of Rails 5.1 and the new `rails-ujs`, the parameters `data, status, xhr` +have been bundled into `event.detail`. For information about the previously used +`jquery-ujs` in Rails 5 and earlier, read the [`jquery-ujs` wiki](https://github.com/rails/jquery-ujs/wiki/ajax). #### link_to @@ -376,12 +377,16 @@ document.body.addEventListener('ajax:success', function(event) { }) ``` +NOTE: As of Rails 5.1 and the new `rails-ujs`, the parameters `data, status, xhr` +have been bundled into `event.detail`. For information about the previously used +`jquery-ujs` in Rails 5 and earlier, read the [`jquery-ujs` wiki](https://github.com/rails/jquery-ujs/wiki/ajax). + ### Stoppable events If you stop `ajax:before` or `ajax:beforeSend` by returning false from the handler method, the Ajax request will never take place. The `ajax:before` event -is also useful for manipulating form data before serialization. The -`ajax:beforeSend` event is also useful for adding custom request headers. +can manipulate form data before serialization and the +`ajax:beforeSend` event is useful for adding custom request headers. If you stop the `ajax:aborted:file` event, the default behavior of allowing the browser to submit the form via normal means (i.e. non-Ajax submission) will be |