# Yahoo! UI Library

### DataSource Utility 2.8.2r1

Yahoo! UI Library > datasource > YAHOO.util.XHRDataSource
Search:
Filters
Show Private Show Protected Show Deprecated

## Class YAHOO.util.XHRDataSource - extends YAHOO.util.DataSourceBase

XHRDataSource class for accessing remote data via the YUI Connection Manager Utility

### Constructor

YAHOO.util.XHRDataSource `( oLiveData , oConfigs )`

Parameters:
  `oLiveData <HTMLElement>` Pointer to live data.
  `oConfigs <object>` (optional) Object literal of configuration values.

### Properties

#### _xhrCallback - `private object`

Define Connection Manager callback object

#### connMethodPost - `Boolean`

True if data is to be sent via POST. By default, data will be sent via GET.
Default Value: false

#### connMgr - `Object`

Alias to YUI Connection Manager, to allow implementers to use a custom class.
Default Value: YAHOO.util.Connect

#### connTimeout - `Number`

The connection timeout defines how many milliseconds the XHR connection will wait for a server response. Any non-zero value will enable the Connection Manager's Auto-Abort feature.
Default Value: 0

#### connXhrMode - `String`

Defines request/response management in the following manner:

queueRequests
  If a request is already in progress, wait until response is returned before sending the next request.
cancelStaleRequests
  If a request is already in progress, cancel it before sending the next request.
ignoreStaleResponses
  Send all requests, but handle only the response for the most recently sent request.
allowAll
  Send all requests and handle all responses.

Default Value: "allowAll"

#### Properties inherited from YAHOO.util.DataSourceBase:

`_aCache, _aIntervals, _oQueue, _sName, dataType, ERROR_DATAINVALID, ERROR_DATANULL, liveData, maxCacheEntries, parseJSONArgs, responseSchema, responseType, TYPE_HTMLTABLE, TYPE_JSARRAY, TYPE_JSFUNCTION, TYPE_JSON, TYPE_LOCAL, TYPE_SCRIPTNODE, TYPE_TEXT, TYPE_UNKNOWN, TYPE_XHR, TYPE_XML, useXPath`

### Methods

#### _xhrFailure

`private void _xhrFailure ( oResponse )`
Define Connection Manager failure handler

Parameters:
  `oResponse <Object>` HTTPXMLRequest object

#### _xhrSuccess

`private void _xhrSuccess ( oResponse )`
Define Connection Manager success handler

Parameters:
  `oResponse <Object>` HTTPXMLRequest object

#### makeConnection

`Number makeConnection ( oRequest , oCallback , oCaller )`
Overriding method passes query to Connection Manager. The returned response is then forwarded to the handleResponse function.

Parameters:
  `oRequest <Object>` Request object.
  `oCallback <Object>` Callback object literal.
  `oCaller <Object>` (deprecated) Use oCallback.scope.

Returns: `Number`
  Transaction ID.

#### Methods inherited from YAHOO.util.DataSourceBase:

`addToCache, clearAllIntervals, clearInterval, doBeforeCallback, doBeforeParseData, flushCache, getCachedResponse, handleResponse, isCacheHit, makeConnection, parseArrayData, parseData, parseHTMLTableData, parseJSONData, parseTextData, parseXMLData, parseXMLResult, sendRequest, setInterval, toString`

#### Events inherited from YAHOO.util.DataSourceBase:

`cacheFlushEvent, cacheRequestEvent, cacheResponseEvent, dataErrorEvent, requestEvent, responseCacheEvent, responseEvent, responseParseEvent,`

Copyright © 2010 Yahoo! Inc. All rights reserved.