Skip to content

Commit

Permalink
fix(src) MSXML2.XMLHTTP.3.0 only use ActiveXObject
Browse files Browse the repository at this point in the history
  • Loading branch information
9renpoto committed Jun 5, 2017
1 parent 83a5563 commit 8709de3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ function addQueryString(url, params) {

// https://gist.github.com/Xeoncross/7663273
function ajax(url, options, callback, data, cache) {

if (data && typeof data === 'object') {
if (!cache) {
data['_t'] = new Date();
}
}
// URL encoded form data must be in querystring format
data = addQueryString('', data).slice(1);
}
Expand All @@ -35,7 +35,12 @@ function ajax(url, options, callback, data, cache) {
}

try {
var x = new (XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0');
var x
if (XMLHttpRequest) {
x = new XMLHttpRequest();
} else {
x = ActiveXObject('MSXML2.XMLHTTP.3.0');
}
x.open(data ? 'POST' : 'GET', url, 1);
if (!options.crossDomain) {
x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
Expand Down

0 comments on commit 8709de3

Please sign in to comment.