From 39268c4c1212cca8022ce77bc5e3a1bf56616c5c Mon Sep 17 00:00:00 2001 From: Indrek Juhkam Date: Wed, 17 Oct 2012 01:16:33 +0300 Subject: [PATCH] Only add withCredentials to xhrFields when needed This solves IE8.0.6001.18702CO bug. Please see http://bugs.jquery.com/ticket/12750. withCredentials is false by default, so no need to add it when it is null or false. --- src/rails.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rails.js b/src/rails.js index df9dc862..3069b578 100644 --- a/src/rails.js +++ b/src/rails.js @@ -146,6 +146,11 @@ data = element.data('params') || null; } + var xhrFields = {} + if (withCredentials) { + xhrFields["withCredentials"] = withCredentials; + } + options = { type: method || 'GET', data: data, dataType: dataType, // stopping the "ajax:beforeSend" event will cancel the ajax request @@ -164,9 +169,7 @@ error: function(xhr, status, error) { element.trigger('ajax:error', [xhr, status, error]); }, - xhrFields: { - withCredentials: withCredentials - }, + xhrFields: xhrFields, crossDomain: crossDomain }; // Only pass url to `ajax` options if not blank