aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/app/assets/javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/app/assets/javascripts')
-rw-r--r--actionview/app/assets/javascripts/README.md5
-rw-r--r--actionview/app/assets/javascripts/rails-ujs/start.coffee2
-rw-r--r--actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee2
3 files changed, 5 insertions, 4 deletions
diff --git a/actionview/app/assets/javascripts/README.md b/actionview/app/assets/javascripts/README.md
index 0819d5da5f..f321b9f720 100644
--- a/actionview/app/assets/javascripts/README.md
+++ b/actionview/app/assets/javascripts/README.md
@@ -30,7 +30,7 @@ Run `yarn add rails-ujs` to install the rails-ujs package.
Usage
------------
-Require `rails-ujs` into your application.js manifest.
+Require `rails-ujs` in your application.js manifest.
```javascript
//= require rails-ujs
@@ -39,7 +39,8 @@ Require `rails-ujs` into your application.js manifest.
Usage with yarn
------------
-When using with Webpacker gem or your preferred JavaScript bundler. Just add the following to your main JS file and compile.
+When using with the Webpacker gem or your preferred JavaScript bundler, just
+add the following to your main JS file and compile.
```javascript
import Rails from 'rails-ujs';
diff --git a/actionview/app/assets/javascripts/rails-ujs/start.coffee b/actionview/app/assets/javascripts/rails-ujs/start.coffee
index 5746a22287..55595ac96f 100644
--- a/actionview/app/assets/javascripts/rails-ujs/start.coffee
+++ b/actionview/app/assets/javascripts/rails-ujs/start.coffee
@@ -9,7 +9,7 @@
} = Rails
# For backward compatibility
-if jQuery? and not jQuery.rails
+if jQuery? and jQuery.ajax? and not jQuery.rails
jQuery.rails = Rails
jQuery.ajaxPrefilter (options, originalOptions, xhr) ->
CSRFProtection(xhr) unless options.crossDomain
diff --git a/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee b/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee
index 26df7b9a3f..a653d3af3d 100644
--- a/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee
+++ b/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee
@@ -14,7 +14,7 @@ AcceptHeaders =
Rails.ajax = (options) ->
options = prepareOptions(options)
xhr = createXHR options, ->
- response = processResponse(xhr.response, xhr.getResponseHeader('Content-Type'))
+ response = processResponse(xhr.response ? xhr.responseText, xhr.getResponseHeader('Content-Type'))
if xhr.status // 100 == 2
options.success?(response, xhr.statusText, xhr)
else