|
106 | 106 |
|
107 | 107 | // Submits "remote" forms and links with ajax |
108 | 108 | handleRemote: function(element) { |
109 | | - var method, url, data, crossDomain, dataType, options; |
| 109 | + var method, url, data, crossDomain, withCredentials, dataType, options; |
110 | 110 |
|
111 | 111 | if (rails.fire(element, 'ajax:before')) { |
112 | 112 | crossDomain = element.data('cross-domain') || null; |
| 113 | + withCredentials = element.data('with-credentials') || null; |
113 | 114 | dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType); |
114 | 115 |
|
115 | 116 | if (element.is('form')) { |
|
134 | 135 | } |
135 | 136 |
|
136 | 137 | options = { |
137 | | - type: method || 'GET', data: data, dataType: dataType, crossDomain: crossDomain, |
| 138 | + type: method || 'GET', data: data, dataType: dataType, |
138 | 139 | // stopping the "ajax:beforeSend" event will cancel the ajax request |
139 | 140 | beforeSend: function(xhr, settings) { |
140 | 141 | if (settings.dataType === undefined) { |
|
150 | 151 | }, |
151 | 152 | error: function(xhr, status, error) { |
152 | 153 | element.trigger('ajax:error', [xhr, status, error]); |
153 | | - } |
| 154 | + }, |
| 155 | + xhrFields: { |
| 156 | + withCredentials: withCredentials |
| 157 | + }, |
| 158 | + crossDomain: crossDomain |
154 | 159 | }; |
155 | 160 | // Only pass url to `ajax` options if not blank |
156 | 161 | if (url) { options.url = url; } |
|
274 | 279 | element.data('ujs:enable-with', element.html()); // store enabled state |
275 | 280 | element.html(element.data('disable-with')); // set to disabled state |
276 | 281 | element.bind('click.railsDisable', function(e) { // prevent further clicking |
277 | | - return rails.stopEverything(e) |
| 282 | + return rails.stopEverything(e); |
278 | 283 | }); |
279 | 284 | }, |
280 | 285 |
|
|
0 commit comments