Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / api / Ext.Ajax.html
1 <!DOCTYPE html><html><head><title>Ext.Ajax | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
2 <style type="text/css">.head-band { display: none; }
3 .header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
4 .doc-tab .members .member a.more { background-color: #efefef; }
5 </style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
6 </head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
7 <a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">
8
9     req = {
10         liveURL: '.',
11         standAloneMode: true,
12         origDocClass: 'Ext.Ajax',
13         docClass: 'Ext.Ajax',
14         docReq: 'Ext.Ajax',
15         version: '4.0',
16         baseURL: '.',
17         baseDocURL: '.',
18         baseProdURL: '.'
19     };
20
21     clsInfo = {};
22
23
24
25 </script>
26
27 <script type="text/javascript" src="../search.js"></script>
28 <!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
29 <script type="text/javascript" src="../class_tree.js"></script>
30 <script type="text/javascript" src="../class_doc.js"></script>
31 <script type="text/javascript">
32     req.source = 'Ajax.html#Ext-Ajax';
33     clsInfo = {"methods":["abort","addEvents","addListener","addManagedListener","capture","clearListeners","clearManagedListeners","enableBubble","fireEvent","hasListener","isLoading","observe","on","parseStatus","relayEvents","releaseCapture","removeListener","removeManagedListener","request","resumeEvents","setOptions","suspendEvents","un","upload"],"cfgs":["listeners","timeout"],"properties":["autoAbort","defaultHeaders","disableCaching","disableCachingParam","extraParams","method","onreadystatechange","timeout","url","useDefaultHeader"],"events":["beforerequest","requestcomplete","requestexception"],"subclasses":[]};
34     Ext.onReady(function() {
35         Ext.create('Docs.classPanel');
36     });
37 </script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Ajax.html#Ext-Ajax" target="_blank">Ext.Ajax</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><pre class="subclasses"><h4>Hierarchy</h4><div class="subclass f"><a href="Ext.data.Connection.html" rel="Ext.data.Connection" class="cls docClass">Ext.data.Connection</a><div class="subclass"><strong>Ext.Ajax</strong></div></div><h4>Mixins</h4><div class="mixin"><a href="Ext.util.Observable.html" rel="Ext.util.Observable" class="cls docClass">Ext.util.Observable</a></div></pre><p>A singleton instance of an <a href="Ext.data.Connection.html" rel="Ext.data.Connection" class="docClass">Ext.data.Connection</a>. This class
38 is used to communicate with your server side code. It can be used as follows:</p>
39
40 <pre class="prettyprint"><code>Ext.Ajax.request({
41     url: 'page.php',
42     params: {
43         id: 1
44     },
45     success: function(response){
46         var text = response.responseText;
47         // process server response here
48     }
49 });
50 </code></pre>
51
52 <p>Default options for all requests can be set be changing a property on the <a href="Ext.Ajax.html" rel="Ext.Ajax" class="docClass">Ext.Ajax</a> class:</p>
53
54 <pre class="prettyprint"><code>Ext.Ajax.timeout = 60000; // 60 seconds
55 </code></pre>
56
57 <p>Any options specified in the request method for the Ajax request will override any
58 defaults set on the <a href="Ext.Ajax.html" rel="Ext.Ajax" class="docClass">Ext.Ajax</a> class. In the code sample below, the timeout for the
59 request will be 60 seconds.</p>
60
61 <pre class="prettyprint"><code>Ext.Ajax.timeout = 120000; // 120 seconds
62 Ext.Ajax.request({
63     url: 'page.aspx',
64     timeout: 60000
65 });
66 </code></pre>
67
68 <p>In general, this class will be used for all Ajax requests in your application.
69 The main reason for creating a separate <a href="Ext.data.Connection.html" rel="Ext.data.Connection" class="docClass">Ext.data.Connection</a> is for a
70 series of requests that share common settings that are different to all other
71 requests in the application.</p>
72 <div class="members"><div class="m-cfgs"><div class="definedBy">Defined By</div><a name="configs"></a><h3 class="cfg p">Config Options</h3><h4 class="cfgGroup">Other Configs</h4><div id="config-listeners" class="member f inherited"><a href="Ext.Ajax.html#config-listeners" rel="config-listeners" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-cfg-listeners" class="viewSource">view source</a></div><a name="listeners"></a><a name="config-listeners"></a><a href="Ext.Ajax.html#" rel="config-listeners" class="cls expand">listeners</a><span> : Object</span></div><div class="description"><div class="short">(optional) A config object containing one or more event handlers to be added to this
73 object during initialization.  T...</div><div class="long"><p>(optional) <p>A config object containing one or more event handlers to be added to this
74 object during initialization.  This should be a valid listeners config object as specified in the
75 <a href="Ext.Ajax.html#addListener" rel="Ext.Ajax#addListener" class="docClass">addListener</a> example for attaching multiple handlers at once.</p></p>
76
77 <br><p><b><u>DOM events from ExtJs <a href="Ext.Component.html" rel="Ext.Component" class="docClass">Components</a></u></b></p>
78
79
80 <br><p>While <i>some</i> ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
81
82
83 <p>is usually only done when extra value can be added. For example the <a href="Ext.view.View.html" rel="Ext.view.View" class="docClass">DataView</a>'s
84 <b><code><a href="Ext.view.View.html#click" rel="Ext.view.View#click" class="docClass">click</a></code></b> event passing the node clicked on. To access DOM
85 events directly from a child element of a Component, we need to specify the <code>element</code> option to
86 identify the Component property to add a DOM listener to:</p>
87
88 <pre><code>new Ext.panel.Panel({
89     width: 400,
90     height: 200,
91     dockedItems: [{
92         xtype: 'toolbar'
93     }],
94     listeners: {
95         click: {
96             element: 'el', //bind to the underlying el property on the panel
97             fn: function(){ console.log('click el'); }
98         },
99         dblclick: {
100             element: 'body', //bind to the underlying body property on the panel
101             fn: function(){ console.log('dblclick body'); }
102         }
103     }
104 });
105 </code></pre>
106
107
108 <p></p></p>
109 </div></div></div><div id="config-timeout" class="member inherited"><a href="Ext.Ajax.html#config-timeout" rel="config-timeout" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-cfg-timeout" class="viewSource">view source</a></div><a name="timeout"></a><a name="config-timeout"></a><a href="Ext.Ajax.html#" rel="config-timeout" class="cls expand">timeout</a><span> : Number</span></div><div class="description"><div class="short"><p>(Optional) The timeout in milliseconds to be used for requests. (defaults to 30000)</p>
110 </div><div class="long"><p>(Optional) The timeout in milliseconds to be used for requests. (defaults to 30000)</p>
111 </div></div></div></div><div class="m-properties"><a name="properties"></a><div class="definedBy">Defined By</div><h3 class="prp p">Properties</h3><div id="property-autoAbort" class="member f ni"><a href="Ext.Ajax.html#property-autoAbort" rel="property-autoAbort" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Ajax.html" class="definedIn docClass">Ext.Ajax</a><br/><a href="../source/Ajax.html#Ext-Ajax-property-autoAbort" class="viewSource">view source</a></div><a name="autoAbort"></a><a name="property-autoAbort"></a><a href="Ext.Ajax.html#" rel="property-autoAbort" class="cls expand">autoAbort</a><span> : Boolean</span></div><div class="description"><div class="short"><p>Whether a new request should abort any pending requests. (defaults to false)</p>
112 </div><div class="long"><p>Whether a new request should abort any pending requests. (defaults to false)</p>
113 </div></div></div><div id="property-defaultHeaders" class="member ni"><a href="Ext.Ajax.html#property-defaultHeaders" rel="property-defaultHeaders" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Ajax.html" class="definedIn docClass">Ext.Ajax</a><br/><a href="../source/Ajax.html#Ext-Ajax-property-defaultHeaders" class="viewSource">view source</a></div><a name="defaultHeaders"></a><a name="property-defaultHeaders"></a><a href="Ext.Ajax.html#" rel="property-defaultHeaders" class="cls expand">defaultHeaders</a><span> : Object</span></div><div class="description"><div class="short"><p>An object containing request headers which are added to each request made by this object
114 (defaults to undefined).</p>
115 </div><div class="long"><p>An object containing request headers which are added to each request made by this object
116 (defaults to undefined).</p>
117 </div></div></div><div id="property-disableCaching" class="member ni"><a href="Ext.Ajax.html#property-disableCaching" rel="property-disableCaching" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Ajax.html" class="definedIn docClass">Ext.Ajax</a><br/><a href="../source/Ajax.html#Ext-Ajax-property-disableCaching" class="viewSource">view source</a></div><a name="disableCaching"></a><a name="property-disableCaching"></a><a href="Ext.Ajax.html#" rel="property-disableCaching" class="cls expand">disableCaching</a><span> : Boolean</span></div><div class="description"><div class="short"><p>True to add a unique cache-buster param to GET requests. (defaults to true)</p>
118 </div><div class="long"><p>True to add a unique cache-buster param to GET requests. (defaults to true)</p>
119 </div></div></div><div id="property-disableCachingParam" class="member inherited"><a href="Ext.Ajax.html#property-disableCachingParam" rel="property-disableCachingParam" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-property-disableCachingParam" class="viewSource">view source</a></div><a name="disableCachingParam"></a><a name="property-disableCachingParam"></a><a href="Ext.Ajax.html#" rel="property-disableCachingParam" class="cls expand">disableCachingParam</a><span> : String</span></div><div class="description"><div class="short"><p>(Optional) Change the parameter which is sent went disabling caching
120 through a cache buster. Defaults to '_dc'</p>
121 </div><div class="long"><p>(Optional) Change the parameter which is sent went disabling caching
122 through a cache buster. Defaults to '_dc'</p>
123 </div></div></div><div id="property-extraParams" class="member ni"><a href="Ext.Ajax.html#property-extraParams" rel="property-extraParams" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Ajax.html" class="definedIn docClass">Ext.Ajax</a><br/><a href="../source/Ajax.html#Ext-Ajax-property-extraParams" class="viewSource">view source</a></div><a name="extraParams"></a><a name="property-extraParams"></a><a href="Ext.Ajax.html#" rel="property-extraParams" class="cls expand">extraParams</a><span> : Object</span></div><div class="description"><div class="short">An object containing properties which are used as extra parameters to each request made
124 by this object (defaults to u...</div><div class="long"><p>An object containing properties which are used as extra parameters to each request made
125 by this object (defaults to undefined). Session information and other data that you need
126 to pass with each request are commonly put here.</p>
127 </div></div></div><div id="property-method" class="member ni"><a href="Ext.Ajax.html#property-method" rel="property-method" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Ajax.html" class="definedIn docClass">Ext.Ajax</a><br/><a href="../source/Ajax.html#Ext-Ajax-property-method" class="viewSource">view source</a></div><a name="method"></a><a name="property-method"></a><a href="Ext.Ajax.html#" rel="property-method" class="cls expand">method</a><span> : String</span></div><div class="description"><div class="short">The default HTTP method to be used for requests. Note that this is case-sensitive and
128 should be all caps (defaults to...</div><div class="long"><p>The default HTTP method to be used for requests. Note that this is case-sensitive and
129 should be all caps (defaults to undefined; if not set but params are present will use
130 <tt>"POST"</tt>, otherwise will use <tt>"GET"</tt>.)</p>
131 </div></div></div><div id="property-onreadystatechange" class="member inherited"><a href="Ext.Ajax.html#property-onreadystatechange" rel="property-onreadystatechange" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-property-onreadystatechange" class="viewSource">view source</a></div><a name="onreadystatechange"></a><a name="property-onreadystatechange"></a><a href="Ext.Ajax.html#" rel="property-onreadystatechange" class="cls expand">onreadystatechange</a><span> : Object</span></div><div class="description"><div class="short">Clear out the onreadystatechange here, this allows us
132 greater control, the browser may/may not fire the function
133 depe...</div><div class="long"><p>Clear out the onreadystatechange here, this allows us
134 greater control, the browser may/may not fire the function
135 depending on a series of conditions.</p>
136 </div></div></div><div id="property-timeout" class="member ni"><a href="Ext.Ajax.html#property-timeout" rel="property-timeout" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Ajax.html" class="definedIn docClass">Ext.Ajax</a><br/><a href="../source/Ajax.html#Ext-Ajax-property-timeout" class="viewSource">view source</a></div><a name="timeout"></a><a name="property-timeout"></a><a href="Ext.Ajax.html#" rel="property-timeout" class="cls expand">timeout</a><span> : Number</span></div><div class="description"><div class="short"><p>The timeout in milliseconds to be used for requests. (defaults to 30000)</p>
137 </div><div class="long"><p>The timeout in milliseconds to be used for requests. (defaults to 30000)</p>
138 </div></div></div><div id="property-url" class="member ni"><a href="Ext.Ajax.html#property-url" rel="property-url" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Ajax.html" class="definedIn docClass">Ext.Ajax</a><br/><a href="../source/Ajax.html#Ext-Ajax-property-url" class="viewSource">view source</a></div><a name="url"></a><a name="property-url"></a><a href="Ext.Ajax.html#" rel="property-url" class="cls expand">url</a><span> : String</span></div><div class="description"><div class="short">The default URL to be used for requests to the server. (defaults to undefined)
139 If the server receives all requests th...</div><div class="long"><p>The default URL to be used for requests to the server. (defaults to undefined)
140 If the server receives all requests through one URL, setting this once is easier than
141 entering it on every request.</p>
142 </div></div></div><div id="property-useDefaultHeader" class="member inherited"><a href="Ext.Ajax.html#property-useDefaultHeader" rel="property-useDefaultHeader" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-property-useDefaultHeader" class="viewSource">view source</a></div><a name="useDefaultHeader"></a><a name="property-useDefaultHeader"></a><a href="Ext.Ajax.html#" rel="property-useDefaultHeader" class="cls expand">useDefaultHeader</a><span> : Boolean</span></div><div class="description"><div class="short"><p>&nbsp;</p></div><div class="long">
143 </div></div></div></div><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-abort" class="member f inherited"><a href="Ext.Ajax.html#method-abort" rel="method-abort" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-method-abort" class="viewSource">view source</a></div><a name="abort"></a><a name="method-abort"></a><a href="Ext.Ajax.html#" rel="method-abort" class="cls expand">abort</a>(
144 <span class="pre">Object request</span>)
145  : void</div><div class="description"><div class="short"><p>Aborts any outstanding request.</p>
146 </div><div class="long"><p>Aborts any outstanding request.</p>
147 <h3 class="pa">Parameters</h3><ul><li><span class="pre">request</span> : Object<div class="sub-desc"><p>(Optional) defaults to the last request</p>
148 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
149 </li></ul></div></div></div><div id="method-addEvents" class="member inherited"><a href="Ext.Ajax.html#method-addEvents" rel="method-addEvents" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-addEvents" class="viewSource">view source</a></div><a name="addEvents"></a><a name="method-addEvents"></a><a href="Ext.Ajax.html#" rel="method-addEvents" class="cls expand">addEvents</a>(
150 <span class="pre">Object/String o, String </span>)
151  : void</div><div class="description"><div class="short"><p>Adds the specified events to the list of events which this Observable may fire.</p>
152 </div><div class="long"><p>Adds the specified events to the list of events which this Observable may fire.</p>
153 <h3 class="pa">Parameters</h3><ul><li><span class="pre">o</span> : Object/String<div class="sub-desc"><p>Either an object with event names as properties with a value of <code>true</code>
154 or the first event name string if multiple event names are being passed as separate parameters.</p>
155 </div></li><li><span class="pre"></span> : String<div class="sub-desc"><p>[additional] Optional additional event names if multiple event names are being passed as separate parameters.
156 Usage:</p>
157
158 <pre><code>this.addEvents('storeloaded', 'storecleared');
159 </code></pre>
160
161 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
162 </li></ul></div></div></div><div id="method-addListener" class="member inherited"><a href="Ext.Ajax.html#method-addListener" rel="method-addListener" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-addListener" class="viewSource">view source</a></div><a name="addListener"></a><a name="method-addListener"></a><a href="Ext.Ajax.html#" rel="method-addListener" class="cls expand">addListener</a>(
163 <span class="pre">String eventName, Function handler, [Object scope], [Object options]</span>)
164  : void</div><div class="description"><div class="short"><p>Appends an event handler to this object.</p>
165 </div><div class="long"><p>Appends an event handler to this object.</p>
166 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The name of the event to listen for. May also be an object who's property names are event names. See</p>
167 </div></li><li><span class="pre">handler</span> : Function<div class="sub-desc"><p>The method the event invokes.</p>
168 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
169 <b>If omitted, defaults to the object which fired the event.</b></p>
170 </div></li><li><span class="pre">options</span> : Object<div class="sub-desc"><p>(optional) An object containing handler configuration.
171 properties. This may contain any of the following properties:<ul>
172 <li><b>scope</b> : Object<div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.
173 <b>If omitted, defaults to the object which fired the event.</b></div></li>
174 <li><b>delay</b> : Number<div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>
175 <li><b>single</b> : Boolean<div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
176 <li><b>buffer</b> : Number<div class="sub-desc">Causes the handler to be scheduled to run in an <a href="Ext.util.DelayedTask.html" rel="Ext.util.DelayedTask" class="docClass">Ext.util.DelayedTask</a> delayed
177 by the specified number of milliseconds. If the event fires again within that time, the original
178 handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
179 <li><b>target</b> : Observable<div class="sub-desc">Only call the handler if the event was fired on the target Observable, <i>not</i>
180 if the event was bubbled up from a child Observable.</div></li>
181 <li><b>element</b> : String<div class="sub-desc"><b>This option is only valid for listeners bound to <a href="Ext.Component.html" rel="Ext.Component" class="docClass">Components</a>.</b>
182 The name of a Component property which references an element to add a listener to.</p>
183
184 <p>This option is useful during Component construction to add DOM event listeners to elements of <a href="Ext.Component.html" rel="Ext.Component" class="docClass">Components</a> which
185 will exist only after the Component is rendered. For example, to add a click listener to a Panel's body:
186 <pre><code>new Ext.panel.Panel({
187     title: 'The title',
188     listeners: {
189         click: this.handlePanelClick,
190         element: 'body'
191     }
192 });
193 </code></pre></p>
194
195
196 <p>When added in this way, the options available are the options applicable to <a href="Ext.core.Element.html#addListener" rel="Ext.core.Element#addListener" class="docClass">Ext.core.Element.addListener</a></p>
197
198
199 <p></div></li>
200 </ul><br></p>
201
202 <p>
203 <b>Combining Options</b><br>
204 Using the options argument, it is possible to combine different types of listeners:<br>
205 <br>
206 A delayed, one-time listener.
207 <pre><code>myPanel.on('hide', this.handleClick, this, {
208 single: true,
209 delay: 100
210 });</code></pre>
211 <p>
212 <b>Attaching multiple handlers in 1 call</b><br>
213 The method also allows for a single argument to be passed which is a config object containing properties
214 which specify multiple events. For example:
215 <pre><code>myGridPanel.on({
216     cellClick: this.onCellClick,
217     mouseover: this.onMouseOver,
218     mouseout: this.onMouseOut,
219     scope: this // Important. Ensure "this" is correct during handler execution
220 });
221 </code></pre>.
222 <p>
223
224 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
225 </li></ul></div></div></div><div id="method-addManagedListener" class="member inherited"><a href="Ext.Ajax.html#method-addManagedListener" rel="method-addManagedListener" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-addManagedListener" class="viewSource">view source</a></div><a name="addManagedListener"></a><a name="method-addManagedListener"></a><a href="Ext.Ajax.html#" rel="method-addManagedListener" class="cls expand">addManagedListener</a>(
226 <span class="pre">Observable/Element item, Object/String ename, Function fn, Object scope, Object opt</span>)
227  : void</div><div class="description"><div class="short"><p>Adds listeners to any Observable object (or Element) which are automatically removed when this Component
228 is destroyed.
229
230 </div><div class="long"><p>Adds listeners to any Observable object (or Element) which are automatically removed when this Component
231 is destroyed.
232
233 <h3 class="pa">Parameters</h3><ul><li><span class="pre">item</span> : Observable/Element<div class="sub-desc"><p>The item to which to add a listener/listeners.</p>
234 </div></li><li><span class="pre">ename</span> : Object/String<div class="sub-desc"><p>The event name, or an object containing event name properties.</p>
235 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>Optional. If the <code>ename</code> parameter was an event name, this
236 is the handler function.</p>
237 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>Optional. If the <code>ename</code> parameter was an event name, this
238 is the scope (<code>this</code> reference) in which the handler function is executed.</p>
239 </div></li><li><span class="pre">opt</span> : Object<div class="sub-desc"><p>Optional. If the <code>ename</code> parameter was an event name, this
240 is the <a href="Ext.util.Observable.html#addListener" rel="Ext.util.Observable#addListener" class="docClass">addListener</a> options.</p>
241 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
242 </li></ul></div></div></div><div id="method-capture" class="member inherited"><a href="Ext.Ajax.html#method-capture" rel="method-capture" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-capture" class="viewSource">view source</a></div><a name="capture"></a><a name="method-capture"></a><a href="Ext.Ajax.html#" rel="method-capture" class="cls expand">capture</a>(
243 <span class="pre">Observable o, Function fn, [Object scope]</span>)
244  : void</div><div class="description"><div class="short">Starts capture on the specified Observable. All events will be passed
245 to the supplied function with the event name + ...</div><div class="long"><p>Starts capture on the specified Observable. All events will be passed
246 to the supplied function with the event name + standard signature of the event
247 <b>before</b> the event is fired. If the supplied function returns false,
248 the event will not fire.</p>
249 <h3 class="pa">Parameters</h3><ul><li><span class="pre">o</span> : Observable<div class="sub-desc"><p>The Observable to capture events from.</p>
250 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>The function to call when an event is fired.</p>
251 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the Observable firing the event.</p>
252 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
253 </li></ul></div></div></div><div id="method-clearListeners" class="member inherited"><a href="Ext.Ajax.html#method-clearListeners" rel="method-clearListeners" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-clearListeners" class="viewSource">view source</a></div><a name="clearListeners"></a><a name="method-clearListeners"></a><a href="Ext.Ajax.html#" rel="method-clearListeners" class="cls expand">clearListeners</a> : void</div><div class="description"><div class="short"><p>Removes all listeners for this object including the managed listeners</p>
254 </div><div class="long"><p>Removes all listeners for this object including the managed listeners</p>
255 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
256 </li></ul></div></div></div><div id="method-clearManagedListeners" class="member inherited"><a href="Ext.Ajax.html#method-clearManagedListeners" rel="method-clearManagedListeners" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-clearManagedListeners" class="viewSource">view source</a></div><a name="clearManagedListeners"></a><a name="method-clearManagedListeners"></a><a href="Ext.Ajax.html#" rel="method-clearManagedListeners" class="cls expand">clearManagedListeners</a> : void</div><div class="description"><div class="short"><p>Removes all managed listeners for this object.</p>
257 </div><div class="long"><p>Removes all managed listeners for this object.</p>
258 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
259 </li></ul></div></div></div><div id="method-enableBubble" class="member inherited"><a href="Ext.Ajax.html#method-enableBubble" rel="method-enableBubble" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-enableBubble" class="viewSource">view source</a></div><a name="enableBubble"></a><a name="method-enableBubble"></a><a href="Ext.Ajax.html#" rel="method-enableBubble" class="cls expand">enableBubble</a>(
260 <span class="pre">String/Array events</span>)
261  : void</div><div class="description"><div class="short">Enables events fired by this Observable to bubble up an owner hierarchy by calling
262 this.getBubbleTarget() if present....</div><div class="long"><p>Enables events fired by this Observable to bubble up an owner hierarchy by calling
263 <code>this.getBubbleTarget()</code> if present. There is no implementation in the Observable base class.</p>
264
265
266 <p>This is commonly used by Ext.Components to bubble events to owner Containers. See <a href="Ext.Component.html#getBubbleTarget" rel="Ext.Component#getBubbleTarget" class="docClass">Ext.Component.getBubbleTarget</a>. The default
267 implementation in <a href="Ext.Component.html" rel="Ext.Component" class="docClass">Ext.Component</a> returns the Component's immediate owner. But if a known target is required, this can be overridden to
268 access the required target more quickly.</p>
269
270
271 <p>Example:</p>
272
273
274 <pre><code>Ext.override(Ext.form.field.Base, {
275 //  Add functionality to Field&#39;s initComponent to enable the change event to bubble
276 initComponent : Ext.Function.createSequence(Ext.form.field.Base.prototype.initComponent, function() {
277     this.enableBubble('change');
278 }),
279
280 //  We know that we want Field&#39;s events to bubble directly to the FormPanel.
281 getBubbleTarget : function() {
282     if (!this.formPanel) {
283         this.formPanel = this.findParentByType('form');
284     }
285     return this.formPanel;
286 }
287 });
288
289 var myForm = new Ext.formPanel({
290 title: 'User Details',
291 items: [{
292     ...
293 }],
294 listeners: {
295     change: function() {
296         // Title goes red if form has been modified.
297         myForm.header.setStyle('color', 'red');
298     }
299 }
300 });
301 </code></pre>
302
303 <h3 class="pa">Parameters</h3><ul><li><span class="pre">events</span> : String/Array<div class="sub-desc"><p>The event name to bubble, or an Array of event names.</p>
304 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
305 </li></ul></div></div></div><div id="method-fireEvent" class="member inherited"><a href="Ext.Ajax.html#method-fireEvent" rel="method-fireEvent" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-fireEvent" class="viewSource">view source</a></div><a name="fireEvent"></a><a name="method-fireEvent"></a><a href="Ext.Ajax.html#" rel="method-fireEvent" class="cls expand">fireEvent</a>(
306 <span class="pre">String eventName, Object... args</span>)
307  : Boolean</div><div class="description"><div class="short">Fires the specified event with the passed parameters (minus the event name).
308
309
310 An event may be set to bubble up an Ob...</div><div class="long"><p>Fires the specified event with the passed parameters (minus the event name).</p>
311
312
313 <p>An event may be set to bubble up an Observable parent hierarchy (See <a href="Ext.Component.html#getBubbleTarget" rel="Ext.Component#getBubbleTarget" class="docClass">Ext.Component.getBubbleTarget</a>)
314 by calling <a href="Ext.Ajax.html#enableBubble" rel="Ext.Ajax#enableBubble" class="docClass">enableBubble</a>.</p>
315
316 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The name of the event to fire.</p>
317 </div></li><li><span class="pre">args</span> : Object...<div class="sub-desc"><p>Variable number of parameters are passed to handlers.</p>
318 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>returns false if any of the handlers return false otherwise it returns true.</p>
319 </li></ul></div></div></div><div id="method-hasListener" class="member inherited"><a href="Ext.Ajax.html#method-hasListener" rel="method-hasListener" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-hasListener" class="viewSource">view source</a></div><a name="hasListener"></a><a name="method-hasListener"></a><a href="Ext.Ajax.html#" rel="method-hasListener" class="cls expand">hasListener</a>(
320 <span class="pre">String eventName</span>)
321  : Boolean</div><div class="description"><div class="short"><p>Checks to see if this object has any listeners for a specified event</p>
322 </div><div class="long"><p>Checks to see if this object has any listeners for a specified event</p>
323 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The name of the event to check for</p>
324 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if the event is being listened for, else false</p>
325 </li></ul></div></div></div><div id="method-isLoading" class="member inherited"><a href="Ext.Ajax.html#method-isLoading" rel="method-isLoading" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-method-isLoading" class="viewSource">view source</a></div><a name="isLoading"></a><a name="method-isLoading"></a><a href="Ext.Ajax.html#" rel="method-isLoading" class="cls expand">isLoading</a>(
326 <span class="pre">Object request</span>)
327  : Boolean</div><div class="description"><div class="short"><p>Determine whether this object has a request outstanding.</p>
328 </div><div class="long"><p>Determine whether this object has a request outstanding.</p>
329 <h3 class="pa">Parameters</h3><ul><li><span class="pre">request</span> : Object<div class="sub-desc"><p>(Optional) defaults to the last transaction</p>
330 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if there is an outstanding request.</p>
331 </li></ul></div></div></div><div id="method-observe" class="member inherited"><a href="Ext.Ajax.html#method-observe" rel="method-observe" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-observe" class="viewSource">view source</a></div><a name="observe"></a><a name="method-observe"></a><a href="Ext.Ajax.html#" rel="method-observe" class="cls expand">observe</a>(
332 <span class="pre">Function c, Object listeners</span>)
333  : void</div><div class="description"><div class="short">Sets observability on the passed class constructor.
334
335 This makes any event fired on any instance of the passed class a...</div><div class="long"><p>Sets observability on the passed class constructor.</p>
336
337 <p>This makes any event fired on any instance of the passed class also fire a single event through
338 the <strong>class</strong> allowing for central handling of events on many instances at once.</p>
339
340 <p>Usage:</p>
341
342 <pre><code>Ext.util.Observable.observe(Ext.data.Connection);
343 Ext.data.Connection.on('beforerequest', function(con, options) {
344     console.log('Ajax request made to ' + options.url);
345 });
346 </code></pre>
347 <h3 class="pa">Parameters</h3><ul><li><span class="pre">c</span> : Function<div class="sub-desc"><p>The class constructor to make observable.</p>
348 </div></li><li><span class="pre">listeners</span> : Object<div class="sub-desc"><p>An object containing a series of listeners to add. See <a href="Ext.Ajax.html#addListener" rel="Ext.Ajax#addListener" class="docClass">addListener</a>.</p>
349 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
350 </li></ul></div></div></div><div id="method-on" class="member inherited"><a href="Ext.Ajax.html#method-on" rel="method-on" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-on" class="viewSource">view source</a></div><a name="on"></a><a name="method-on"></a><a href="Ext.Ajax.html#" rel="method-on" class="cls expand">on</a>(
351 <span class="pre">String eventName, Function handler, [Object scope], [Object options]</span>)
352  : void</div><div class="description"><div class="short"><p>Appends an event handler to this object (shorthand for <a href="Ext.Ajax.html#addListener" rel="Ext.Ajax#addListener" class="docClass">addListener</a>.)</p>
353 </div><div class="long"><p>Appends an event handler to this object (shorthand for <a href="Ext.Ajax.html#addListener" rel="Ext.Ajax#addListener" class="docClass">addListener</a>.)</p>
354 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The type of event to listen for</p>
355 </div></li><li><span class="pre">handler</span> : Function<div class="sub-desc"><p>The method the event invokes</p>
356 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
357 <b>If omitted, defaults to the object which fired the event.</b></p>
358 </div></li><li><span class="pre">options</span> : Object<div class="sub-desc"><p>(optional) An object containing handler configuration.</p>
359 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
360 </li></ul></div></div></div><div id="method-parseStatus" class="member inherited"><a href="Ext.Ajax.html#method-parseStatus" rel="method-parseStatus" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-method-parseStatus" class="viewSource">view source</a></div><a name="parseStatus"></a><a name="method-parseStatus"></a><a href="Ext.Ajax.html#" rel="method-parseStatus" class="cls expand">parseStatus</a>(
361 <span class="pre">Number status</span>)
362  : Object</div><div class="description"><div class="short"><p>Check if the response status was successful</p>
363 </div><div class="long"><p>Check if the response status was successful</p>
364 <h3 class="pa">Parameters</h3><ul><li><span class="pre">status</span> : Number<div class="sub-desc"><p>The status code</p>
365 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span>&nbsp; &nbsp;<p>An object containing success/status state</p>
366 </li></ul></div></div></div><div id="method-relayEvents" class="member inherited"><a href="Ext.Ajax.html#method-relayEvents" rel="method-relayEvents" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-relayEvents" class="viewSource">view source</a></div><a name="relayEvents"></a><a name="method-relayEvents"></a><a href="Ext.Ajax.html#" rel="method-relayEvents" class="cls expand">relayEvents</a>(
367 <span class="pre">Object origin, Array events, Object prefix</span>)
368  : void</div><div class="description"><div class="short"><p>Relays selected events from the specified Observable as if the events were fired by <code><b>this</b></code>.</p>
369 </div><div class="long"><p>Relays selected events from the specified Observable as if the events were fired by <code><b>this</b></code>.</p>
370 <h3 class="pa">Parameters</h3><ul><li><span class="pre">origin</span> : Object<div class="sub-desc"><p>The Observable whose events this object is to relay.</p>
371 </div></li><li><span class="pre">events</span> : Array<div class="sub-desc"><p>Array of event names to relay.</p>
372 </div></li><li><span class="pre">prefix</span> : Object<div class="sub-desc">
373 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
374 </li></ul></div></div></div><div id="method-releaseCapture" class="member inherited"><a href="Ext.Ajax.html#method-releaseCapture" rel="method-releaseCapture" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-releaseCapture" class="viewSource">view source</a></div><a name="releaseCapture"></a><a name="method-releaseCapture"></a><a href="Ext.Ajax.html#" rel="method-releaseCapture" class="cls expand">releaseCapture</a>(
375 <span class="pre">Observable o</span>)
376  : void</div><div class="description"><div class="short"><p>Removes <b>all</b> added captures from the Observable.</p>
377 </div><div class="long"><p>Removes <b>all</b> added captures from the Observable.</p>
378 <h3 class="pa">Parameters</h3><ul><li><span class="pre">o</span> : Observable<div class="sub-desc"><p>The Observable to release</p>
379 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
380 </li></ul></div></div></div><div id="method-removeListener" class="member inherited"><a href="Ext.Ajax.html#method-removeListener" rel="method-removeListener" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-removeListener" class="viewSource">view source</a></div><a name="removeListener"></a><a name="method-removeListener"></a><a href="Ext.Ajax.html#" rel="method-removeListener" class="cls expand">removeListener</a>(
381 <span class="pre">String eventName, Function handler, [Object scope]</span>)
382  : void</div><div class="description"><div class="short"><p>Removes an event handler.</p>
383 </div><div class="long"><p>Removes an event handler.</p>
384 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The type of event the handler was associated with.</p>
385 </div></li><li><span class="pre">handler</span> : Function<div class="sub-desc"><p>The handler to remove. <b>This must be a reference to the function passed into the <a href="Ext.Ajax.html#addListener" rel="Ext.Ajax#addListener" class="docClass">addListener</a> call.</b></p>
386 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(optional) The scope originally specified for the handler.</p>
387 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
388 </li></ul></div></div></div><div id="method-removeManagedListener" class="member inherited"><a href="Ext.Ajax.html#method-removeManagedListener" rel="method-removeManagedListener" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-removeManagedListener" class="viewSource">view source</a></div><a name="removeManagedListener"></a><a name="method-removeManagedListener"></a><a href="Ext.Ajax.html#" rel="method-removeManagedListener" class="cls expand">removeManagedListener</a>(
389 <span class="pre">Observable|Element item, Object|String ename, Function fn, Object scope</span>)
390  : void</div><div class="description"><div class="short"><p>Removes listeners that were added by the <a href="Ext.Ajax.html#mon" rel="Ext.Ajax#mon" class="docClass">mon</a> method.</p>
391 </div><div class="long"><p>Removes listeners that were added by the <a href="Ext.Ajax.html#mon" rel="Ext.Ajax#mon" class="docClass">mon</a> method.</p>
392 <h3 class="pa">Parameters</h3><ul><li><span class="pre">item</span> : Observable|Element<div class="sub-desc"><p>The item from which to remove a listener/listeners.</p>
393 </div></li><li><span class="pre">ename</span> : Object|String<div class="sub-desc"><p>The event name, or an object containing event name properties.</p>
394 </div></li><li><span class="pre">fn</span> : Function<div class="sub-desc"><p>Optional. If the <code>ename</code> parameter was an event name, this
395 is the handler function.</p>
396 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>Optional. If the <code>ename</code> parameter was an event name, this
397 is the scope (<code>this</code> reference) in which the handler function is executed.</p>
398 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
399 </li></ul></div></div></div><div id="method-request" class="member inherited"><a href="Ext.Ajax.html#method-request" rel="method-request" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-method-request" class="viewSource">view source</a></div><a name="request"></a><a name="method-request"></a><a href="Ext.Ajax.html#" rel="method-request" class="cls expand">request</a>(
400 <span class="pre">Object options</span>)
401  : Object</div><div class="description"><div class="short">Sends an HTTP request to a remote server.
402
403
404 Important: Ajax server requests are asynchronous, and this call will
405 retu...</div><div class="long"><p>Sends an HTTP request to a remote server.</p>
406
407
408 <p><b>Important:</b> Ajax server requests are asynchronous, and this call will
409 return before the response has been received. Process any returned data
410 in a callback function.</p>
411
412
413 <pre><code>Ext.Ajax.request({
414 url: 'ajax_demo/sample.json',
415 success: function(response, opts) {
416   var obj = Ext.decode(response.responseText);
417   console.dir(obj);
418 },
419 failure: function(response, opts) {
420   console.log('server-side failure with status code ' + response.status);
421 }
422 });
423 </code></pre>
424
425
426 <p>To execute a callback function in the correct scope, use the <tt>scope</tt> option.</p>
427
428 <h3 class="pa">Parameters</h3><ul><li><span class="pre">options</span> : Object<div class="sub-desc"><p>An object which may contain the following properties:<ul>
429 <li><b>url</b> : String/Function (Optional)<div class="sub-desc">The URL to
430 which to send the request, or a function to call which returns a URL string. The scope of the
431 function is specified by the <tt>scope</tt> option. Defaults to the configured
432 <tt><a href="Ext.Ajax.html#url" rel="Ext.Ajax#url" class="docClass">url</a></tt>.</div></li>
433 <li><b>params</b> : Object/String/Function (Optional)<div class="sub-desc">
434 An object containing properties which are used as parameters to the
435 request, a url encoded string or a function to call to get either. The scope of the function
436 is specified by the <tt>scope</tt> option.</div></li>
437 <li><b>method</b> : String (Optional)<div class="sub-desc">The HTTP method to use
438 for the request. Defaults to the configured method, or if no method was configured,
439 "GET" if no parameters are being sent, and "POST" if parameters are being sent.  Note that
440 the method name is case-sensitive and should be all caps.</div></li>
441 <li><b>callback</b> : Function (Optional)<div class="sub-desc">The
442 function to be called upon receipt of the HTTP response. The callback is
443 called regardless of success or failure and is passed the following
444 parameters:<ul>
445 <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
446 <li><b>success</b> : Boolean<div class="sub-desc">True if the request succeeded.</div></li>
447 <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.
448 See <a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a> for details about
449 accessing elements of the response.</div></li>
450 </ul></div></li>
451 <li><a id="request-option-success"></a><b>success</b> : Function (Optional)<div class="sub-desc">The function
452 to be called upon success of the request. The callback is passed the following
453 parameters:<ul>
454 <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
455 <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
456 </ul></div></li>
457 <li><b>failure</b> : Function (Optional)<div class="sub-desc">The function
458 to be called upon failure of the request. The callback is passed the
459 following parameters:<ul>
460 <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>
461 <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>
462 </ul></div></li>
463 <li><b>scope</b> : Object (Optional)<div class="sub-desc">The scope in
464 which to execute the callbacks: The "this" object for the callback function. If the <tt>url</tt>, or <tt>params</tt> options were
465 specified as functions from which to draw values, then this also serves as the scope for those function calls.
466 Defaults to the browser window.</div></li>
467 <li><b>timeout</b> : Number (Optional)<div class="sub-desc">The timeout in milliseconds to be used for this request. Defaults to 30 seconds.</div></li>
468 <li><b>form</b> : Element/HTMLElement/String (Optional)<div class="sub-desc">The <tt>&lt;form&gt;</tt>
469 Element or the id of the <tt>&lt;form&gt;</tt> to pull parameters from.</div></li>
470 <li><a id="request-option-isUpload"></a><b>isUpload</b> : Boolean (Optional)<div class="sub-desc"><b>Only meaningful when used
471 with the <tt>form</tt> option</b>.</p>
472
473 <p>True if the form object is a file upload (will be set automatically if the form was
474 configured with <b><tt>enctype</tt></b> "multipart/form-data").</p>
475
476
477 <p>File uploads are not performed using normal "Ajax" techniques, that is they are <b>not</b>
478 performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the
479 DOM <tt>&lt;form></tt> element temporarily modified to have its
480 <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
481 to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document
482 but removed after the return data has been gathered.</p>
483
484
485 <p>The server response is parsed by the browser to create the document for the IFRAME. If the
486 server is using JSON to send the return object, then the
487 <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
488 must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
489
490
491 <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
492 is created containing a <tt>responseText</tt> property in order to conform to the
493 requirements of event handlers and callbacks.</p>
494
495
496 <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
497 and some server technologies (notably JEE) may require some custom processing in order to
498 retrieve parameter names and parameter values from the packet content.</p>
499
500
501 <p></div></li>
502 <li><b>headers</b> : Object (Optional)<div class="sub-desc">Request
503 headers to set for the request.</div></li>
504 <li><b>xmlData</b> : Object (Optional)<div class="sub-desc">XML document
505 to use for the post. Note: This will be used instead of params for the post
506 data. Any params will be appended to the URL.</div></li>
507 <li><b>jsonData</b> : Object/String (Optional)<div class="sub-desc">JSON
508 data to use as the post. Note: This will be used instead of params for the post
509 data. Any params will be appended to the URL.</div></li>
510 <li><b>disableCaching</b> : Boolean (Optional)<div class="sub-desc">True
511 to add a unique cache-buster param to GET requests.</div></li>
512 </ul></p></p>
513
514 <p>The options object may also contain any other property which might be needed to perform
515 postprocessing in a callback because it is passed to callback functions.</p>
516
517 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span>&nbsp; &nbsp;<p>request The request object. This may be used
518 to cancel the request.</p>
519 </li></ul></div></div></div><div id="method-resumeEvents" class="member inherited"><a href="Ext.Ajax.html#method-resumeEvents" rel="method-resumeEvents" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-resumeEvents" class="viewSource">view source</a></div><a name="resumeEvents"></a><a name="method-resumeEvents"></a><a href="Ext.Ajax.html#" rel="method-resumeEvents" class="cls expand">resumeEvents</a> : void</div><div class="description"><div class="short">Resume firing events. (see suspendEvents)
520 If events were suspended using the queueSuspended parameter, then all
521 event...</div><div class="long"><p>Resume firing events. (see <a href="Ext.Ajax.html#suspendEvents" rel="Ext.Ajax#suspendEvents" class="docClass">suspendEvents</a>)
522 If events were suspended using the <code><b>queueSuspended</b></code> parameter, then all
523 events fired during event suspension will be sent to any listeners now.</p>
524 <h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
525 </li></ul></div></div></div><div id="method-setOptions" class="member inherited"><a href="Ext.Ajax.html#method-setOptions" rel="method-setOptions" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-method-setOptions" class="viewSource">view source</a></div><a name="setOptions"></a><a name="method-setOptions"></a><a href="Ext.Ajax.html#" rel="method-setOptions" class="cls expand">setOptions</a>(
526 <span class="pre">Object options, Object scope</span>)
527  : Object</div><div class="description"><div class="short"><p>Set various options such as the url, params for the request</p>
528 </div><div class="long"><p>Set various options such as the url, params for the request</p>
529 <h3 class="pa">Parameters</h3><ul><li><span class="pre">options</span> : Object<div class="sub-desc"><p>The initial options</p>
530 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>The scope to execute in</p>
531 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Object</span>&nbsp; &nbsp;<p>The params for the request</p>
532 </li></ul></div></div></div><div id="method-suspendEvents" class="member inherited"><a href="Ext.Ajax.html#method-suspendEvents" rel="method-suspendEvents" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-suspendEvents" class="viewSource">view source</a></div><a name="suspendEvents"></a><a name="method-suspendEvents"></a><a href="Ext.Ajax.html#" rel="method-suspendEvents" class="cls expand">suspendEvents</a>(
533 <span class="pre">Boolean queueSuspended</span>)
534  : void</div><div class="description"><div class="short"><p>Suspend the firing of all events. (see <a href="Ext.Ajax.html#resumeEvents" rel="Ext.Ajax#resumeEvents" class="docClass">resumeEvents</a>)</p>
535 </div><div class="long"><p>Suspend the firing of all events. (see <a href="Ext.Ajax.html#resumeEvents" rel="Ext.Ajax#resumeEvents" class="docClass">resumeEvents</a>)</p>
536 <h3 class="pa">Parameters</h3><ul><li><span class="pre">queueSuspended</span> : Boolean<div class="sub-desc"><p>Pass as true to queue up suspended events to be fired
537 after the <a href="Ext.Ajax.html#resumeEvents" rel="Ext.Ajax#resumeEvents" class="docClass">resumeEvents</a> call instead of discarding all suspended events;</p>
538 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
539 </li></ul></div></div></div><div id="method-un" class="member inherited"><a href="Ext.Ajax.html#method-un" rel="method-un" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.util.Observable.html" class="definedIn docClass">Ext.util.Observable</a><br/><a href="../source/Observable.html#Ext-util.Observable-method-un" class="viewSource">view source</a></div><a name="un"></a><a name="method-un"></a><a href="Ext.Ajax.html#" rel="method-un" class="cls expand">un</a>(
540 <span class="pre">String eventName, Function handler, [Object scope]</span>)
541  : void</div><div class="description"><div class="short"><p>Removes an event handler (shorthand for <a href="Ext.Ajax.html#removeListener" rel="Ext.Ajax#removeListener" class="docClass">removeListener</a>.)</p>
542 </div><div class="long"><p>Removes an event handler (shorthand for <a href="Ext.Ajax.html#removeListener" rel="Ext.Ajax#removeListener" class="docClass">removeListener</a>.)</p>
543 <h3 class="pa">Parameters</h3><ul><li><span class="pre">eventName</span> : String<div class="sub-desc"><p>The type of event the handler was associated with.</p>
544 </div></li><li><span class="pre">handler</span> : Function<div class="sub-desc"><p>The handler to remove. <b>This must be a reference to the function passed into the <a href="Ext.Ajax.html#addListener" rel="Ext.Ajax#addListener" class="docClass">addListener</a> call.</b></p>
545 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>(optional) The scope originally specified for the handler.</p>
546 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
547 </li></ul></div></div></div><div id="method-upload" class="member inherited"><a href="Ext.Ajax.html#method-upload" rel="method-upload" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-method-upload" class="viewSource">view source</a></div><a name="upload"></a><a name="method-upload"></a><a href="Ext.Ajax.html#" rel="method-upload" class="cls expand">upload</a>(
548 <span class="pre">Mixed form, String url, String params, Object options</span>)
549  : void</div><div class="description"><div class="short"><p>Upload a form using a hidden iframe.</p>
550 </div><div class="long"><p>Upload a form using a hidden iframe.</p>
551 <h3 class="pa">Parameters</h3><ul><li><span class="pre">form</span> : Mixed<div class="sub-desc"><p>The form to upload</p>
552 </div></li><li><span class="pre">url</span> : String<div class="sub-desc"><p>The url to post to</p>
553 </div></li><li><span class="pre">params</span> : String<div class="sub-desc"><p>Any extra parameters to pass</p>
554 </div></li><li><span class="pre">options</span> : Object<div class="sub-desc"><p>The initial options</p>
555 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
556 </li></ul></div></div></div></div><div class="m-events"><a name="events"></a><div class="definedBy">Defined By</div><h3 class="evt p">Events</h3><div id="event-beforerequest" class="member f inherited"><a href="Ext.Ajax.html#event-beforerequest" rel="event-beforerequest" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-event-beforerequest" class="viewSource">view source</a></div><a name="beforerequest"></a><a name="event-beforerequest"></a><a href="Ext.Ajax.html#" rel="event-beforerequest" class="cls expand">beforerequest</a>(
557 <span class="pre">Connection conn, Object options</span>)
558 </div><div class="description"><div class="short"><p>Fires before a network request is made to retrieve a data object.</p>
559 </div><div class="long"><p>Fires before a network request is made to retrieve a data object.</p>
560 <h3 class="pa">Parameters</h3><ul><li><span class="pre">conn</span> : Connection<div class="sub-desc"><p>This Connection object.</p>
561 </div></li><li><span class="pre">options</span> : Object<div class="sub-desc"><p>The options config object passed to the <a href="Ext.Ajax.html#request" rel="Ext.Ajax#request" class="docClass">request</a> method.</p>
562 </div></li></ul></div></div></div><div id="event-requestcomplete" class="member inherited"><a href="Ext.Ajax.html#event-requestcomplete" rel="event-requestcomplete" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-event-requestcomplete" class="viewSource">view source</a></div><a name="requestcomplete"></a><a name="event-requestcomplete"></a><a href="Ext.Ajax.html#" rel="event-requestcomplete" class="cls expand">requestcomplete</a>(
563 <span class="pre">Connection conn, Object response, Object options</span>)
564 </div><div class="description"><div class="short"><p>Fires if the request was successfully completed.</p>
565 </div><div class="long"><p>Fires if the request was successfully completed.</p>
566 <h3 class="pa">Parameters</h3><ul><li><span class="pre">conn</span> : Connection<div class="sub-desc"><p>This Connection object.</p>
567 </div></li><li><span class="pre">response</span> : Object<div class="sub-desc"><p>The XHR object containing the response data.
568 See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
569 for details.</p>
570 </div></li><li><span class="pre">options</span> : Object<div class="sub-desc"><p>The options config object passed to the <a href="Ext.Ajax.html#request" rel="Ext.Ajax#request" class="docClass">request</a> method.</p>
571 </div></li></ul></div></div></div><div id="event-requestexception" class="member inherited"><a href="Ext.Ajax.html#event-requestexception" rel="event-requestexception" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.Connection.html" class="definedIn docClass">Ext.data.Connection</a><br/><a href="../source/Connection.html#Ext-data.Connection-event-requestexception" class="viewSource">view source</a></div><a name="requestexception"></a><a name="event-requestexception"></a><a href="Ext.Ajax.html#" rel="event-requestexception" class="cls expand">requestexception</a>(
572 <span class="pre">Connection conn, Object response, Object options</span>)
573 </div><div class="description"><div class="short">Fires if an error HTTP status was returned from the server.
574 See HTTP Status Code Definitions
575 for details of HTTP stat...</div><div class="long"><p>Fires if an error HTTP status was returned from the server.
576 See <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP Status Code Definitions</a>
577 for details of HTTP status codes.</p>
578 <h3 class="pa">Parameters</h3><ul><li><span class="pre">conn</span> : Connection<div class="sub-desc"><p>This Connection object.</p>
579 </div></li><li><span class="pre">response</span> : Object<div class="sub-desc"><p>The XHR object containing the response data.
580 See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
581 for details.</p>
582 </div></li><li><span class="pre">options</span> : Object<div class="sub-desc"><p>The options config object passed to the <a href="Ext.Ajax.html#request" rel="Ext.Ajax#request" class="docClass">request</a> method.</p>
583 </div></li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>