lib/Ext/form/Panel.js
function(options) {
        options = options || {};

        var me = this,
            api = me.getApi(),
            url = me.getUrl() || options.url,
            waitMsg = options.waitMsg,
            successFn = function(response, data) {
                me.setValues(data.data);

                if (Ext.isFunction(options.success)) {
                    options.success.call(options.scope || me, me, response, data);
                }

                me.fireEvent('load', me, response);
            },
            failureFn = function(response, data) {
                if (Ext.isFunction(options.failure)) {
                    options.failure.call(scope, me, response, data);
                }

                me.fireEvent('exception', me, response);
            },
            load, method, args;

        if (options.waitMsg) {
            if (typeof waitMsg === 'string') {
                waitMsg = {
                    xtype   : 'loadmask',
                    message : waitMsg
                };
            }

            me.setMasked(waitMsg);
        }

        if (api) {
            load = api.load;

            if (typeof load === 'string') {
                load = Ext.direct.Manager.parseMethod(load);

                if (load) {
                    api.load = load;
                }
            }

            if (load) {
                method = load.directCfg.method;
                args = method.getArgs(me.getParams(options.params), me.getParamOrder(), me.getParamsAsHash());

                args.push(function(data, response, success) {
                    me.setMasked(false);

                    if (success) {
                        successFn(response, data);
                    } else {
                        failureFn(response, data);
                    }
                }, me);

                return load.apply(window, args);
            }
        } else if (url) {
            return Ext.Ajax.request({
                url: url,
                timeout: (options.timeout || this.getTimeout()) * 1000,
                method: options.method || 'GET',
                autoAbort: options.autoAbort,
                headers: Ext.apply(
                    {
                        'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8'
                    },
                    options.headers || {}
                ),
                callback: function(callbackOptions, success, response) {
                    var responseText = response.responseText,
                        statusResult = Ext.Ajax.parseStatus(response.status, response);

                    me.setMasked(false);

                    if (success) {
                        if (statusResult && responseText.length == 0) {
                            success = true;
                        } else {
                            response = Ext.decode(responseText);
                            success = !!response.success;
                        }
                        if (success) {
                            successFn(response, responseText);
                        } else {
                            failureFn(response, responseText);
                        }
                    }
                    else {
                        failureFn(response, responseText);
                    }
                }
            });
        }
    }
function(options) {
        options = options || {};

        var me = this,
            api = me.getApi(),
            url = me.getUrl() || options.url,
            waitMsg = options.waitMsg,
            successFn = function(response, data) {
                me.setValues(data.data);

                if (Ext.isFunction(options.success)) {
                    options.success.call(options.scope || me, me, response, data);
                }

                me.fireEvent('load', me, response);
            },
            failureFn = function(response, data) {
                if (Ext.isFunction(options.failure)) {
                    options.failure.call(scope, me, response, data);
                }

                me.fireEvent('exception', me, response);
            },
            load, method, args;

        if (options.waitMsg) {
            if (typeof waitMsg === 'string') {
                waitMsg = {
                    xtype   : 'loadmask',
                    message : waitMsg
                };
            }

            me.setMasked(waitMsg);
        }

        if (api) {
            load = api.load;

            if (typeof load === 'string') {
                load = Ext.direct.Manager.parseMethod(load);

                if (load) {
                    api.load = load;
                }
            }

            if (load) {
                method = load.directCfg.method;
                args = method.getArgs(me.getParams(options.params), me.getParamOrder(), me.getParamsAsHash());

                args.push(function(data, response, success) {
                    me.setMasked(false);

                    if (success) {
                        successFn(response, data);
                    } else {
                        failureFn(response, data);
                    }
                }, me);

                return load.apply(window, args);
            }
        } else if (url) {
            return Ext.Ajax.request({
                url: url,
                timeout: (options.timeout || this.getTimeout()) * 1000,
                method: options.method || 'GET',
                autoAbort: options.autoAbort,
                headers: Ext.apply(
                    {
                        'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8'
                    },
                    options.headers || {}
                ),
                callback: function(callbackOptions, success, response) {
                    var responseText = response.responseText,
                        statusResult = Ext.Ajax.parseStatus(response.status, response);

                    me.setMasked(false);

                    if (success) {
                        if (statusResult && responseText.length == 0) {
                            success = true;
                        } else {
                            response = Ext.decode(responseText);
                            success = !!response.success;
                        }
                        if (success) {
                            successFn(response, responseText);
                        } else {
                            failureFn(response, responseText);
                        }
                    }
                    else {
                        failureFn(response, responseText);
                    }
                }
            });
        }
    }
Performs an Ajax or Ext.Direct call to load values for this form.

@param {Object} options
The configuration when loading this form.

The following are the configurations when loading via Ajax only:

@param {String} options.url
The url for the action (defaults to the form's {@link #url}).

@param {String} options.method
The form method to use (defaults to the form's {@link #method}, or GET if not defined).

@param {Object} options.headers
Request headers to set for the action.

@param {Number} options.timeout
The number is seconds the loading will timeout in.

The following are the configurations when loading via Ajax or Direct:

@param {Boolean} [options.autoAbort=false]
`true` to abort any pending Ajax request prior to loading.

@param {String/Object} options.params
The params to pass when submitting this form (defaults to this forms {@link #baseParams}).
Parameters are encoded as standard HTTP parameters using {@link Ext#urlEncode}.

@param {String/Object} [options.waitMsg]
If specified, the value which is passed to the loading {@link #masked mask}. See {@link #masked} for
more information.

@param {Function} options.success
The callback that will be invoked after a successful response. A response is successful if
a response is received from the server and is a JSON object where the `success` property is set
to `true`, `{"success": true}`.

The function is passed the following parameters and can be used for loading via Ajax or Direct:

@param {Ext.form.Panel} options.success.form
The {@link Ext.form.Panel} that requested the load.

@param {Object/Ext.direct.Event} options.success.result
The result object returned by the server as a result of the load request. If the loading was done via Ext.Direct,
will return the {@link Ext.direct.Event} instance, otherwise will return an Object.

@param {Object} options.success.data
The parsed data returned by the server.

@param {Function} options.failure
The callback that will be invoked after a failed transaction attempt.

The function is passed the following parameters and can be used for loading via Ajax or Direct:

@param {Ext.form.Panel} options.failure.form
The {@link Ext.form.Panel} that requested the load.

@param {Ext.form.Panel} options.failure.result
The failed response or result object returned by the server which performed the operation.

@param {Object} options.success.data
The parsed data returned by the server.

@param {Object} options.scope
The scope in which to call the callback functions (The `this` reference for the callback functions).

@return {Ext.data.Connection} The request object.