neon-server/src/main/javascript/util/ajaxUtils.js
function doAjaxRequest(type, url, opts) {
        var params = {};
        params.type = type;
        params.url = url;

        // don't just do a blind copy of params here. we want to restrict what can be used to avoid any jquery specific options.
        params.data = opts.data;
        params.contentType = opts.contentType;
        params.dataType = opts.responseType;
        params.success = opts.success;
        params.error = opts.error;
        params.global = opts.global;
        params.async = opts.async;
        logRequest(params);
        var xhr = $.ajax(params);
        return new neon.util.AjaxRequest(xhr);
    }
function doAjaxRequest(type, url, opts) {
        var params = {};
        params.type = type;
        params.url = url;

        // don't just do a blind copy of params here. we want to restrict what can be used to avoid any jquery specific options.
        params.data = opts.data;
        params.contentType = opts.contentType;
        params.dataType = opts.responseType;
        params.success = opts.success;
        params.error = opts.error;
        params.global = opts.global;
        params.async = opts.async;
        logRequest(params);
        var xhr = $.ajax(params);
        return new neon.util.AjaxRequest(xhr);
    }
function doAjaxRequest ( type , url , opts ) { var params = { } ; params . type = type ; params . url = url ; // don't just do a blind copy of params here. we want to restrict what can be used to avoid any jquery specific options. params . data = opts . data ; params . contentType = opts . contentType ; params . dataType = opts . responseType ; params . success = opts . success ; params . error = opts . error ; params . global = opts . global ; params . async = opts . async ; logRequest ( params ) ; var xhr = $ . ajax ( params ) ; return new neon . util . AjaxRequest ( xhr ) ; }
Executes the request using an ajax call
@method doAjaxRequest
@private
@param {String} type The type of request, e.g. <code>GET</code> or <code>POST</code>
@param {String} url The url of the request
@param {Object} opts An associative array of options to configure the call
<ul>
<li>data: Any data to include with the request (typically for POST requests)</li>
<li>contentType: The mime type of data being sent, such as <code>application/json</code></li>
<li>responseType: The type of data expected as a return value, such as <code>json</code> or <code>text</code></li>
<li>success: The callback function to execute on success. It will be passed the return value of the call</li>
<li>async: If the call should be asynchronous (defaults to true)</li>
<li>global: If the call should trigger global ajax handlers</li>
<li>error: The callback function to execute on error. It will have 3 parameters - the xhr, a short error status message and the error message</li>
</ul>
@return {neon.util.AjaxRequest} The xhr request object
Executes the request using an ajax call