dist/aias.js
function request (type, url, data) {
		return new Promise(function (fulfill, reject) {
			// Set ajax to correct XHR type. Source: https://gist.github.com/jed/993585
			var Xhr = window.XMLHttpRequest||ActiveXObject,
					req = new Xhr('MSXML2.XMLHTTP.3.0');

			req.open(type, url, true);
			req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
			req.onreadystatechange = function (e) {
				if (this.readyState === 4) {
					if (this.status === 200) {
						var res = prepareResponse(req.responseText);
						fulfill(res, req);
					}
					else {
						reject(new Error('Request responded with status ' + req.statusText));
					}
				}
			};
			req.send(data);
		});
	}
function request (type, url, data) {
		return new Promise(function (fulfill, reject) {
			// Set ajax to correct XHR type. Source: https://gist.github.com/jed/993585
			var Xhr = window.XMLHttpRequest||ActiveXObject,
					req = new Xhr('MSXML2.XMLHTTP.3.0');

			req.open(type, url, true);
			req.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
			req.onreadystatechange = function (e) {
				if (this.readyState === 4) {
					if (this.status === 200) {
						var res = prepareResponse(req.responseText);
						fulfill(res, req);
					}
					else {
						reject(new Error('Request responded with status ' + req.statusText));
					}
				}
			};
			req.send(data);
		});
	}
function request ( type , url , data ) { return new Promise ( function ( fulfill , reject ) { // Set ajax to correct XHR type. Source: https://gist.github.com/jed/993585 var Xhr = window . XMLHttpRequest || ActiveXObject , req = new Xhr ( 'MSXML2.XMLHTTP.3.0' ) ; req . open ( type , url , true ) ; req . setRequestHeader ( 'Content-type' , 'application/x-www-form-urlencoded' ) ; req . onreadystatechange = function ( e ) { if ( this . readyState === 4 ) { if ( this . status === 200 ) { var res = prepareResponse ( req . responseText ) ; fulfill ( res , req ) ; } else { reject ( new Error ( 'Request responded with status ' + req . statusText ) ) ; } } } ; req . send ( data ) ; } ) ; }
Attempts to parse the response as JSON otherwise returns it untouched.

@param {string} type The HTTP verb to be used.
@param {string} url The url for the XHR request.
@param {object} data Optional. The data to be passed with a POST or PUT request.

@memberof aias
Attempts to parse the response as JSON otherwise returns it untouched .