Commit 830a9671 authored by Romain Courteaud's avatar Romain Courteaud

Support XMLHttpRequest withCredentials parameters.

Use the xhrFields parameters to the ajax method (see jQuery.ajax for
reference).
parent ac7b32f6
...@@ -854,6 +854,13 @@ function ajax(param) { ...@@ -854,6 +854,13 @@ function ajax(param) {
if (typeof param.beforeSend === 'function') { if (typeof param.beforeSend === 'function') {
param.beforeSend(xhr); param.beforeSend(xhr);
} }
if (typeof param.xhrFields === 'object' && param.xhrFields !== null) {
for (k in param.xhrFields) {
if (param.xhrFields.hasOwnProperty(k)) {
xhr[k] = param.xhrFields[k];
}
}
}
xhr.send(param.data); xhr.send(param.data);
}, function () { }, function () {
xhr.abort(); xhr.abort();
......
...@@ -335,6 +335,13 @@ function ajax(param) { ...@@ -335,6 +335,13 @@ function ajax(param) {
if (typeof param.beforeSend === 'function') { if (typeof param.beforeSend === 'function') {
param.beforeSend(xhr); param.beforeSend(xhr);
} }
if (typeof param.xhrFields === 'object' && param.xhrFields !== null) {
for (k in param.xhrFields) {
if (param.xhrFields.hasOwnProperty(k)) {
xhr[k] = param.xhrFields[k];
}
}
}
xhr.send(param.data); xhr.send(param.data);
}, function () { }, function () {
xhr.abort(); xhr.abort();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment