Commit 5901753b authored by Tristan Cavelier's avatar Tristan Cavelier

jIO ajax beforeSend moved just before xhr.send()

parent 63cdd94a
...@@ -332,9 +332,6 @@ function ajax(param) { ...@@ -332,9 +332,6 @@ function ajax(param) {
}); });
xhr.addEventListener("error", reject); xhr.addEventListener("error", reject);
xhr.addEventListener("progress", notify); xhr.addEventListener("progress", notify);
if (typeof param.beforeSend === 'function') {
param.beforeSend(xhr);
}
if (typeof param.xhrFields === 'object' && param.xhrFields !== null) { if (typeof param.xhrFields === 'object' && param.xhrFields !== null) {
for (k in param.xhrFields) { for (k in param.xhrFields) {
if (param.xhrFields.hasOwnProperty(k)) { if (param.xhrFields.hasOwnProperty(k)) {
...@@ -342,6 +339,9 @@ function ajax(param) { ...@@ -342,6 +339,9 @@ function ajax(param) {
} }
} }
} }
if (typeof param.beforeSend === 'function') {
param.beforeSend(xhr);
}
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