lib/sails.io.js
function ajax(opts, cb) {
            opts = opts || {};
            var xmlhttp;

            if (typeof window === 'undefined') {
                // TODO: refactor node usage to live in here
                return cb();
            }

            if (window.XMLHttpRequest) {
                // code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            } else {
                // code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }

            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    cb(xmlhttp.responseText);
                }
            };

            xmlhttp.open(opts.method, opts.url, true);
            xmlhttp.send();
            return xmlhttp;
        }
function ajax(opts, cb) {
            opts = opts || {};
            var xmlhttp;

            if (typeof window === 'undefined') {
                // TODO: refactor node usage to live in here
                return cb();
            }

            if (window.XMLHttpRequest) {
                // code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            } else {
                // code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }

            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    cb(xmlhttp.responseText);
                }
            };

            xmlhttp.open(opts.method, opts.url, true);
            xmlhttp.send();
            return xmlhttp;
        }
function ajax ( opts , cb ) { opts = opts || { } ; var xmlhttp ; if ( typeof window === 'undefined' ) { // TODO: refactor node usage to live in here return cb ( ) ; } if ( window . XMLHttpRequest ) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest ( ) ; } else { // code for IE6, IE5 xmlhttp = new ActiveXObject ( "Microsoft.XMLHTTP" ) ; } xmlhttp . onreadystatechange = function ( ) { if ( xmlhttp . readyState == 4 && xmlhttp . status == 200 ) { cb ( xmlhttp . responseText ) ; } } ; xmlhttp . open ( opts . method , opts . url , true ) ; xmlhttp . send ( ) ; return xmlhttp ; }
Send an AJAX request.

@param  {Object}   opts [optional]
@param  {Function} cb
@return {XMLHttpRequest}
Send an AJAX request .