dist/toolkit.js
function(options, params) {
        var ajax = {};

        // Determine base options
        if ($.type(this.options.ajax) === 'object') {
            ajax = this.options.ajax;
        }

        // Set default options
        if ($.type(options) === 'string') {
            ajax.url = options;

        } else {
            $.extend(ajax, options);
        }

        // Prepare XHR object
        ajax.context = this;
        ajax.beforeSend = function(xhr) {
            xhr.url = ajax.url;
            xhr.cache = ((!ajax.type || ajax.type.toUpperCase() === 'GET') && this.options.cache);
            xhr.settings = ajax;
            xhr.params = params || {};

            this.onRequestBefore.call(this, xhr);
        };

        return $.ajax(ajax)
            .done(this.onRequestDone)
            .fail(this.onRequestFail);
    }
function(options, params) {
        var ajax = {};

        // Determine base options
        if ($.type(this.options.ajax) === 'object') {
            ajax = this.options.ajax;
        }

        // Set default options
        if ($.type(options) === 'string') {
            ajax.url = options;

        } else {
            $.extend(ajax, options);
        }

        // Prepare XHR object
        ajax.context = this;
        ajax.beforeSend = function(xhr) {
            xhr.url = ajax.url;
            xhr.cache = ((!ajax.type || ajax.type.toUpperCase() === 'GET') && this.options.cache);
            xhr.settings = ajax;
            xhr.params = params || {};

            this.onRequestBefore.call(this, xhr);
        };

        return $.ajax(ajax)
            .done(this.onRequestDone)
            .fail(this.onRequestFail);
    }
function ( options , params ) { var ajax = { } ; // Determine base options if ( $ . type ( this . options . ajax ) === 'object' ) { ajax = this . options . ajax ; } // Set default options if ( $ . type ( options ) === 'string' ) { ajax . url = options ; } else { $ . extend ( ajax , options ) ; } // Prepare XHR object ajax . context = this ; ajax . beforeSend = function ( xhr ) { xhr . url = ajax . url ; xhr . cache = ( ( ! ajax . type || ajax . type . toUpperCase ( ) === 'GET' ) && this . options . cache ) ; xhr . settings = ajax ; xhr . params = params || { } ; this . onRequestBefore . call ( this , xhr ) ; } ; return $ . ajax ( ajax ) . done ( this . onRequestDone ) . fail ( this . onRequestFail ) ; }
Request data from a URL and handle all the possible scenarios.

@param {Object} options
@param {Object} [params]
@returns {jQuery.ajax}
Request data from a URL and handle all the possible scenarios .