Properties Methods Events Config Options Direct Link
Observable
  Connection

Class Ext.data.Connection

Package:Ext.data
Defined In:Connection.js
Class:Connection
Subclasses:Ajax
Extends:Observable

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. No data from the server will be available to the statement immediately following the request call. To process returned data, use a success callback in the request options object, or an event listener.

File Uploads

File uploads are not performed using normal "Ajax" techniques, that is they are not performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the DOM <form> element temporarily modified to have its target set to refer to a dynamically generated, hidden <iframe> which is inserted into the document but removed after the return data has been gathered.

The server response is parsed by the browser to create the document for the IFRAME. If the server is using JSON to send the return object, then the Content-Type header must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.

Characters which are significant to an HTML parser must be sent as HTML entities, so encode "<" as "&lt;", "&" as "&amp;" etc.

The response text is retrieved from the document, and a fake XMLHttpRequest object is created containing a responseText property in order to conform to the requirements of event handlers and callbacks.

Be aware that file upload packets are sent with the content type multipart/form and some server technologies (notably JEE) may require some custom processing in order to retrieve parameter names and parameter values from the packet content.

Config Options

Config OptionsDefined By
 autoAbort : Boolean
Whether this request should abort any pending requests. (defaults to false)
Connection
 defaultHeaders : Object
An object containing request headers which are added to each request made by this object. (defaults to undefined)
Connection
 disableCaching : Boolean
True to add a unique cache-buster param to GET requests. (defaults to true)
Connection
 disableCachingParam : String
Change the parameter which is sent went disabling caching through a cache buster. Defaults to '_dc'
Connection
 timeout : Number
The timeout in milliseconds to be used for requests. (defaults to 30000)
Connection

Public Properties

This class has no public properties.

Public Methods

MethodDefined By

Public Events

EventDefined By