Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function (o) {
var xhr = $.xhr(), timer, n = 0;
var deferred = helpers.deferred();
o = helpers.extend({ userAgent: "XMLHttpRequest", lang: "en", type: "GET", data: null, dataType: "application/x-www-form-urlencoded" }, o);
if (o.timeout) {
timer = setTimeout(function () {
xhr.abort();
if (o.timeoutFn) {
o.timeoutFn(o.url);
}
}, o.timeout);
}
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
if (timer) {
clearTimeout(timer);
}
if (xhr.status < 300) {