Skip to content
Browse files

Merge branch 'master' of git://github.com/bradphilips/jquery-ujs into…

… bradphilips-master-rebased

Conflicts:
	src/rails.js
  • Loading branch information...
2 parents 2f6447c + b19fae1 commit 5b6520f3e84b56098bc9a9b86d3b17c08bf0dafa @JangoSteve JangoSteve committed Aug 16, 2012
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/rails.js
View
13 src/rails.js
@@ -117,11 +117,12 @@
// Submits "remote" forms and links with ajax
handleRemote: function(element) {
- var method, url, data, elCrossDomain, crossDomain, dataType, options;
+ var method, url, data, elCrossDomain, crossDomain, withCredentials, dataType, options;
if (rails.fire(element, 'ajax:before')) {
elCrossDomain = element.data('cross-domain');
crossDomain = elCrossDomain === undefined ? null : elCrossDomain;
+ withCredentials = element.data('with-credentials') || null;
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
if (element.is('form')) {
@@ -146,7 +147,7 @@
}
options = {
- type: method || 'GET', data: data, dataType: dataType, crossDomain: crossDomain,
+ type: method || 'GET', data: data, dataType: dataType,
// stopping the "ajax:beforeSend" event will cancel the ajax request
beforeSend: function(xhr, settings) {
if (settings.dataType === undefined) {
@@ -162,7 +163,11 @@
},
error: function(xhr, status, error) {
element.trigger('ajax:error', [xhr, status, error]);
- }
+ },
+ xhrFields: {
+ withCredentials: withCredentials
+ },
+ crossDomain: crossDomain
};
// Only pass url to `ajax` options if not blank
if (url) { options.url = url; }
@@ -289,7 +294,7 @@
element.data('ujs:enable-with', element.html()); // store enabled state
element.html(element.data('disable-with')); // set to disabled state
element.bind('click.railsDisable', function(e) { // prevent further clicking
- return rails.stopEverything(e)
+ return rails.stopEverything(e);
});
},

0 comments on commit 5b6520f

Please sign in to comment.
Something went wrong with that request. Please try again.