Print Friendly

# Class YAHOO.util.Connect

Package: | YAHOO.util
Class: | Connect
Extends: | Object
Defined In: | connection.js

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| abort(`object o`, `object callback`, `string isTimeout`) : boolean | Connect
<static> Method to terminate a transaction, if it has not reached readyState 4.
| asyncRequest(`string method`, `string uri`, `callback callback`, `string postData`) : object | Connect
<static> Method for initiating an asynchronous request via the XHR object.
| initHeader(`string label`, `string value`) : void | Connect
<static> Public method that stores the custom HTTP headers for each transaction.
| isCallInProgress(`object o`) : boolean | Connect
<static> Public method to check if the transaction is still being processed.
| setDefaultPostHeader(`boolean b`) : void | Connect
<static> Member to enable or disable the default POST header.
| setForm(`string ||`, `string optional`, `string ||`) : string | Connect
<static> This method assembles the form label and value pairs and constructs an encoded string. asyncRequest() ...
| setPollingInterval(`int i`) : void | Connect
<static> Member to modify the default polling interval.
| setProgId(`string id`) : void | Connect
<static> Member to add an ActiveX id to the existing xml_progid array. In the event(unlikely) a new ActiveX id ...

## Public Events

This class has no public events.

## Method Details

### abort

`public function abort(`object o`, `object callback`, `string isTimeout`)`
<static> Method to terminate a transaction, if it has not reached readyState 4.
Parameters:

- `o` : object
  The connection object returned by asyncRequest.
- `callback` : object
  User-defined callback object.
- `isTimeout` : string
  boolean to indicate if abort was a timeout.

Returns:

- `boolean`

This method is defined by Connect.

### asyncRequest

`public function asyncRequest(`string method`, `string uri`, `callback callback`, `string postData`)`
<static> Method for initiating an asynchronous request via the XHR object.
Parameters:

- `method` : string
  HTTP transaction method
- `uri` : string
  Fully qualified path of resource
- `callback` : callback
  User-defined callback function or object
- `postData` : string
  POST body

Returns:

- `object`
  Returns the connection object

This method is defined by Connect.

### initHeader

`public function initHeader(`string label`, `string value`)`
<static> Public method that stores the custom HTTP headers for each transaction.
Parameters:

- `label` : string
  The HTTP header label
- `value` : string
  The HTTP header value

Returns:

- `void`

This method is defined by Connect.

### isCallInProgress

`public function isCallInProgress(`object o`)`
<static> Public method to check if the transaction is still being processed.
Parameters:

- `o` : object
  The connection object returned by asyncRequest

Returns:

- `boolean`

This method is defined by Connect.

### setDefaultPostHeader

`public function setDefaultPostHeader(`boolean b`)`
<static> Member to enable or disable the default POST header.
Parameters:

- `b` : boolean
  Set and use default header - true or false .

Returns:

- `void`

This method is defined by Connect.

### setForm

`public function setForm(`string ||`, `string optional`, `string ||`)`
<static> This method assembles the form label and value pairs and constructs an encoded string. asyncRequest() will automatically initialize the transaction with a HTTP header Content-Type of application/x-www-form-urlencoded.
Parameters:

- `||` : string
  object} form id or name attribute, or form object.
- `optional` : string
  boolean to indicate SSL environment.
- `||` : string
  boolean} optional qualified path of iframe resource for SSL in IE.

Returns:

- `string`
  string of the HTML form field name and value pairs..

This method is defined by Connect.

### setPollingInterval

`public function setPollingInterval(`int i`)`
<static> Member to modify the default polling interval.
Parameters:

- `i` : int
  The polling interval in milliseconds.

Returns:

- `void`

This method is defined by Connect.

### setProgId

`public function setProgId(`string id`)`
<static> Member to add an ActiveX id to the existing xml_progid array. In the event(unlikely) a new ActiveX id is introduced, it can be added without internal code modifications.
Parameters:

- `id` : string
  The ActiveX id to be added to initialize the XHR object.

Returns:

- `void`

This method is defined by Connect.

Copyright © 2006 Jack Slocum. All rights reserved.