Print Friendly

# Class Ext.data.Connection

Package: | Ext.data
Class: | Connection
Extends: | Object
Defined In: | Connection.js

The class encapsulates a connection to the page's originating domain, allowing requests to be made either to a configured URL, or to a URL specified at request time.

Requests made by this class are asynchronous, and will return immediately, and no data from the server will be available. To process the returned data, us a callback in the request options object.

Properties - Methods - Events - Config Options

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| Connection(`config {Object}`) | Connection
| abort() : void | Connection
Aborts any outstanding request.
| isLoading() : Boolean | Connection
Determine whether this object has a request outstanding.
| request([`Object options.`]) : void | Connection
Sends an HTTP request to a remote server.

## Public Events

This class has no public events.

## Config Options

Config Options | Defined By
--- | ---
| {Number} : timeout | Connection
(Optional) The timeout in milliseconds to be used for requests. Defaults to 30000.

## Constructor Details

### Connection

`public function Connection(`config {Object}`)`
Parameters:

- `{Object}` : config
  a configuration object.

## Method Details

### abort

`public function abort()`
Aborts any outstanding request.
Parameters:

- None.

Returns:

- `void`

This method is defined by Connection.

### isLoading

`public function isLoading()`
Determine whether this object has a request outstanding.
Parameters:

- None.

Returns:

- `Boolean`
  True if there is an outstanding request.

This method is defined by Connection.

### request

`public function request([`Object options.`])`
Sends an HTTP request to a remote server.
Parameters:

- `options.` : Object
  An object which may contain the following properties:
  - url {String} (Optional) The URL to which to send the request. Defaults to configured URL
  - params {Object} (Optional) An object containing properties which are used as extra parameters to the request
  - method {String} (Optional) The HTTP method to use for the request. Defaults to the configured method, or if no method was configured, "GET" if no parameters are being sent, and "POST" if parameters are being sent.
  - callback {Function} (Optional) The function to be called upon receipt of the HTTP response. The callback is passed the following parameters:
    - options {Object} The parameter to the request call.
    - success {Boolean} True if the request succeeded.
    - resopnse {Object} The XMLHttpRequest object containing the response data.
  - scope {Object} (Optional) The scope in which to execute the callback: The "this" object for the callback function. Defaults to the browser window.

Returns:

- `void`

This method is defined by Connection.

## Config Details

### {Number}

`{Number} : timeout`
(Optional) The timeout in milliseconds to be used for requests. Defaults to 30000.
This config option is defined by Connection.

Ext - Copyright © 2006-2007 Ext JS, LLC
All rights reserved.