dist/ui/chico.js
function getAsyncContent(url, options) {
            var requestCfg;
            // Initial options to be merged with the user's options
            options = tiny.extend({
                'method': 'GET',
                'params': '',
                'waiting': '<div class="ch-loading-large"></div>'
            }, defaults, options);

            // Set loading
            setAsyncContent({
                'status': 'waiting',
                'response': options.waiting
            });

            requestCfg = {
                method: options.method,
                success: function(resp) {
                    setAsyncContent({
                        'status': 'done',
                        'response': resp
                    });
                },
                error: function(err) {
                    setAsyncContent({
                        'status': 'error',
                        'response': '<p>Error on ajax call.</p>',
                        'data': err.message || JSON.stringify(err)
                    });
                }
            };

            if (options.cache !== undefined) {
                that._options.cache = options.cache;
            }

            if (options.cache === false && ['GET', 'HEAD'].indexOf(options.method.toUpperCase()) !== -1) {
                requestCfg.cache = false;
            }

            if (options.params) {
                if (['GET', 'HEAD'].indexOf(options.method.toUpperCase()) !== -1) {
                    url += (url.indexOf('?') !== -1 || options.params[0] === '?' ? '' : '?') + options.params;
                } else {
                    requestCfg.data = options.params;
                }
            }

            // Make a request
            tiny.ajax(url, requestCfg);
        }
function getAsyncContent(url, options) {
            var requestCfg;
            // Initial options to be merged with the user's options
            options = tiny.extend({
                'method': 'GET',
                'params': '',
                'waiting': '<div class="ch-loading-large"></div>'
            }, defaults, options);

            // Set loading
            setAsyncContent({
                'status': 'waiting',
                'response': options.waiting
            });

            requestCfg = {
                method: options.method,
                success: function(resp) {
                    setAsyncContent({
                        'status': 'done',
                        'response': resp
                    });
                },
                error: function(err) {
                    setAsyncContent({
                        'status': 'error',
                        'response': '<p>Error on ajax call.</p>',
                        'data': err.message || JSON.stringify(err)
                    });
                }
            };

            if (options.cache !== undefined) {
                that._options.cache = options.cache;
            }

            if (options.cache === false && ['GET', 'HEAD'].indexOf(options.method.toUpperCase()) !== -1) {
                requestCfg.cache = false;
            }

            if (options.params) {
                if (['GET', 'HEAD'].indexOf(options.method.toUpperCase()) !== -1) {
                    url += (url.indexOf('?') !== -1 || options.params[0] === '?' ? '' : '?') + options.params;
                } else {
                    requestCfg.data = options.params;
                }
            }

            // Make a request
            tiny.ajax(url, requestCfg);
        }
function getAsyncContent ( url , options ) { var requestCfg ; // Initial options to be merged with the user's options options = tiny . extend ( { 'method' : 'GET' , 'params' : '' , 'waiting' : '<div class="ch-loading-large"></div>' } , defaults , options ) ; // Set loading setAsyncContent ( { 'status' : 'waiting' , 'response' : options . waiting } ) ; requestCfg = { method : options . method , success : function ( resp ) { setAsyncContent ( { 'status' : 'done' , 'response' : resp } ) ; } , error : function ( err ) { setAsyncContent ( { 'status' : 'error' , 'response' : '<p>Error on ajax call.</p>' , 'data' : err . message || JSON . stringify ( err ) } ) ; } } ; if ( options . cache !== undefined ) { that . _options . cache = options . cache ; } if ( options . cache === false && [ 'GET' , 'HEAD' ] . indexOf ( options . method . toUpperCase ( ) ) !== - 1 ) { requestCfg . cache = false ; } if ( options . params ) { if ( [ 'GET' , 'HEAD' ] . indexOf ( options . method . toUpperCase ( ) ) !== - 1 ) { url += ( url . indexOf ( '?' ) !== - 1 || options . params [ 0 ] === '?' ? '' : '?' ) + options . params ; } else { requestCfg . data = options . params ; } } // Make a request tiny . ajax ( url , requestCfg ) ; }
Get async content with given URL.
@private
Get async content with given URL .