97a556020f9ca85f136160fb4f7a4ba45f053753.svn-base 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. <div class="body-wrap">
  2. <div class="top-tools">
  3. <a class="inner-link" href="#Ext.Ajax-props"><img src="../resources/images/default/s.gif" class="item-icon icon-prop">Properties</a>
  4. <a class="inner-link" href="#Ext.Ajax-methods"><img src="../resources/images/default/s.gif" class="item-icon icon-method">Methods</a>
  5. <a class="inner-link" href="#Ext.Ajax-events"><img src="../resources/images/default/s.gif" class="item-icon icon-event">Events</a>
  6. <a class="inner-link" href="#Ext.Ajax-configs"><img src="../resources/images/default/s.gif" class="item-icon icon-config">Config Options</a>
  7. <a class="bookmark" href="../docs/?class=Ext.Ajax"><img src="../resources/images/default/s.gif" class="item-icon icon-fav">Direct Link</a>
  8. </div>
  9. <div class="inheritance res-block">
  10. <pre class="res-block-inner"><a ext:cls="Ext.util.Observable" ext:member="" href="output/Ext.util.Observable.html">Observable</a>
  11. <img src="resources/elbow-end.gif"/><a ext:cls="Ext.data.Connection" ext:member="" href="output/Ext.data.Connection.html">Connection</a>
  12. <img src="resources/elbow-end.gif"/>Ajax</pre></div>
  13. <h1>Class Ext.Ajax</h1>
  14. <table cellspacing="0">
  15. <tr><td class="label">Package:</td><td class="hd-info">Ext</td></tr>
  16. <tr><td class="label">Defined In:</td><td class="hd-info"><a href="../src/Connection.js" target="_blank">Connection.js</a></td></tr>
  17. <tr><td class="label">Class:</td><td class="hd-info">Ajax</td></tr>
  18. <tr><td class="label">Extends:</td><td class="hd-info"><a ext:cls="Ext.data.Connection" ext:member="" href="output/Ext.data.Connection.html">Connection</a></td></tr>
  19. </table>
  20. <div class="description">
  21. Global Ajax request class. Provides a simple way to make Ajax requests with maximum flexibility. Example usage:
  22. <pre><code><i>// Basic request</i>
  23. Ext.Ajax.request({
  24. url: <em>'foo.php'</em>,
  25. success: someFn,
  26. failure: otherFn,
  27. headers: {
  28. <em>'my-header'</em>: <em>'foo'</em>
  29. },
  30. params: { foo: <em>'bar'</em> }
  31. });
  32. <i>// Simple ajax form submission</i>
  33. Ext.Ajax.request({
  34. form: <em>'some-form'</em>,
  35. params: <em>'foo=bar'</em>
  36. });
  37. <i>// Default headers to pass <b>in</b> every request</i>
  38. Ext.Ajax.defaultHeaders = {
  39. <em>'Powered-By'</em>: <em>'Ext'</em>
  40. };
  41. <i>// Global Ajax events can be handled on every request!</i>
  42. Ext.Ajax.on(<em>'beforerequest'</em>, <b>this</b>.showSpinner, <b>this</b>);</code></pre><br><br><i>This class is a singleton and cannot be created directly.</i> </div>
  43. <div class="hr"></div>
  44. <a id="Ext.Ajax-configs"></a>
  45. <h2>Config Options</h2>
  46. <table cellspacing="0" class="member-table">
  47. <tr>
  48. <th class="sig-header" colspan="2">Config Options</th>
  49. <th class="msource-header">Defined By</th>
  50. </tr>
  51. <tr class="config-row inherited expandable">
  52. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  53. <td class="sig">
  54. <a id="Ext.Ajax-listeners"></a>
  55. <b>listeners</b> : Object <div class="mdesc">
  56. <div class="short">A config object containing one or more event handlers to be added to this object during initialization. This should b...</div>
  57. <div class="long">
  58. A config object containing one or more event handlers to be added to this object during initialization. This should be a valid listeners config object as specified in the <a ext:cls="Ext.util.Observable" ext:member="addListener" href="output/Ext.util.Observable.html#addListener">addListener</a> example for attaching multiple handlers at once. </div>
  59. </div>
  60. </td>
  61. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#listeners" href="output/Ext.util.Observable.html#listeners">Observable</a></td>
  62. </tr>
  63. </table>
  64. <a id="Ext.Ajax-props"></a>
  65. <h2>Public Properties</h2>
  66. <table cellspacing="0" class="member-table">
  67. <tr>
  68. <th class="sig-header" colspan="2">Property</th>
  69. <th class="msource-header">Defined By</th>
  70. </tr>
  71. <tr class="property-row">
  72. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  73. <td class="sig">
  74. <a id="Ext.Ajax-autoAbort"></a>
  75. <b>autoAbort</b> : Boolean <div class="mdesc">
  76. Whether a new request should abort any pending requests. (defaults to false) </div>
  77. </td>
  78. <td class="msource">Ajax</td>
  79. </tr>
  80. <tr class="property-row alt">
  81. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  82. <td class="sig">
  83. <a id="Ext.Ajax-defaultHeaders"></a>
  84. <b>defaultHeaders</b> : Object <div class="mdesc">
  85. An object containing request headers which are added to each request made by this object. (defaults to undefined) </div>
  86. </td>
  87. <td class="msource">Ajax</td>
  88. </tr>
  89. <tr class="property-row">
  90. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  91. <td class="sig">
  92. <a id="Ext.Ajax-disableCaching"></a>
  93. <b>disableCaching</b> : Boolean <div class="mdesc">
  94. True to add a unique cache-buster param to GET requests. (defaults to true) </div>
  95. </td>
  96. <td class="msource">Ajax</td>
  97. </tr>
  98. <tr class="property-row alt expandable">
  99. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  100. <td class="sig">
  101. <a id="Ext.Ajax-extraParams"></a>
  102. <b>extraParams</b> : Object <div class="mdesc">
  103. <div class="short">
  104. An object containing properties which are used as
  105. extra parameters to each request made by this object. (defaults to...</div>
  106. <div class="long">
  107. An object containing properties which are used as
  108. extra parameters to each request made by this object. (defaults to undefined) </div>
  109. </div>
  110. </td>
  111. <td class="msource">Ajax</td>
  112. </tr>
  113. <tr class="property-row expandable">
  114. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  115. <td class="sig">
  116. <a id="Ext.Ajax-method"></a>
  117. <b>method</b> : String <div class="mdesc">
  118. <div class="short">
  119. The default HTTP method to be used for requests. (defaults to undefined; if not set but parms are present will use P...</div>
  120. <div class="long">
  121. The default HTTP method to be used for requests. (defaults to undefined; if not set but parms are present will use POST, otherwise GET) </div>
  122. </div>
  123. </td>
  124. <td class="msource">Ajax</td>
  125. </tr>
  126. <tr class="property-row alt">
  127. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  128. <td class="sig">
  129. <a id="Ext.Ajax-timeout"></a>
  130. <b>timeout</b> : Number <div class="mdesc">
  131. The timeout in milliseconds to be used for requests. (defaults to 30000) </div>
  132. </td>
  133. <td class="msource">Ajax</td>
  134. </tr>
  135. <tr class="property-row">
  136. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  137. <td class="sig">
  138. <a id="Ext.Ajax-url"></a>
  139. <b>url</b> : String <div class="mdesc">
  140. The default URL to be used for requests to the server. (defaults to undefined) </div>
  141. </td>
  142. <td class="msource">Ajax</td>
  143. </tr>
  144. </table>
  145. <a id="Ext.Ajax-methods"></a>
  146. <h2>Public Methods</h2>
  147. <table cellspacing="0" class="member-table">
  148. <tr>
  149. <th class="sig-header" colspan="2">Method</th>
  150. <th class="msource-header">Defined By</th>
  151. </tr>
  152. <tr class="method-row inherited expandable">
  153. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  154. <td class="sig">
  155. <a id="Ext.Ajax-abort"></a>
  156. <b>abort</b>(&nbsp;<span class="optional" title="Optional">[<code>Number transactionId</code>]</span>&nbsp;) : void <div class="mdesc">
  157. <div class="short">Aborts any outstanding request.</div>
  158. <div class="long">
  159. Aborts any outstanding request. <div class="mdetail-params">
  160. <strong>Parameters:</strong>
  161. <ul><li><code>transactionId</code> : Number<div class="sub-desc">(Optional) defaults to the last transaction</div></li> </ul>
  162. <strong>Returns:</strong>
  163. <ul>
  164. <li><code>void</code></li>
  165. </ul>
  166. </div>
  167. </div>
  168. </div>
  169. </td>
  170. <td class="msource"><a ext:cls="Ext.data.Connection" ext:member="#abort" href="output/Ext.data.Connection.html#abort">Connection</a></td>
  171. </tr>
  172. <tr class="method-row inherited alt expandable">
  173. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  174. <td class="sig">
  175. <a id="Ext.Ajax-addEvents"></a>
  176. <b>addEvents</b>(&nbsp;<code>Object object</code>&nbsp;) : void <div class="mdesc">
  177. <div class="short">Used to define events on this Observable</div>
  178. <div class="long">
  179. Used to define events on this Observable <div class="mdetail-params">
  180. <strong>Parameters:</strong>
  181. <ul><li><code>object</code> : Object<div class="sub-desc">The object with the events defined</div></li> </ul>
  182. <strong>Returns:</strong>
  183. <ul>
  184. <li><code>void</code></li>
  185. </ul>
  186. </div>
  187. </div>
  188. </div>
  189. </td>
  190. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#addEvents" href="output/Ext.util.Observable.html#addEvents">Observable</a></td>
  191. </tr>
  192. <tr class="method-row inherited expandable">
  193. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  194. <td class="sig">
  195. <a id="Ext.Ajax-addListener"></a>
  196. <b>addListener</b>(&nbsp;<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>, <span class="optional" title="Optional">[<code>Object options</code>]</span>&nbsp;) : void <div class="mdesc">
  197. <div class="short">Appends an event handler to this component</div>
  198. <div class="long">
  199. Appends an event handler to this component <div class="mdetail-params">
  200. <strong>Parameters:</strong>
  201. <ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The method the event invokes</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope in which to execute the handler
  202. function. The handler function's "this" context.</div></li><li><code>options</code> : Object<div class="sub-desc">(optional) An object containing handler configuration
  203. properties. This may contain any of the following properties:<ul>
  204. <li><b>scope</b> : Object<p class="sub-desc">The scope in which to execute the handler function. The handler function's "this" context.</p></li>
  205. <li><b>delay</b> : Number<p class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</p></li>
  206. <li><b>single</b> : Boolean<p class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</p></li>
  207. <li>buffer {Number} Causes the handler to be scheduled to run in an <a ext:cls="Ext.util.DelayedTask" href="output/Ext.util.DelayedTask.html">Ext.util.DelayedTask</a> delayed
  208. by the specified number of milliseconds. If the event fires again within that time, the original
  209. handler is <em>not</em> invoked, but the new handler is scheduled in its place.</li>
  210. </ul><br>
  211. <p>
  212. <b>Combining Options</b><br>
  213. Using the options argument, it is possible to combine different types of listeners:<br>
  214. <br>
  215. A normalized, delayed, one-time listener that auto stops the event and passes a custom argument (forumId)
  216. <pre><code>el.on(<em>'click'</em>, <b>this</b>.onClick, <b>this</b>, {
  217. single: true,
  218. delay: 100,
  219. forumId: 4
  220. });</code></pre>
  221. <p>
  222. <b>Attaching multiple handlers in 1 call</b><br>
  223. The method also allows for a single argument to be passed which is a config object containing properties
  224. which specify multiple handlers.
  225. <p>
  226. <pre><code>foo.on({
  227. <em>'click'</em> : {
  228. fn: <b>this</b>.onClick,
  229. scope: <b>this</b>,
  230. delay: 100
  231. },
  232. <em>'mouseover'</em> : {
  233. fn: <b>this</b>.onMouseOver,
  234. scope: <b>this</b>
  235. },
  236. <em>'mouseout'</em> : {
  237. fn: <b>this</b>.onMouseOut,
  238. scope: <b>this</b>
  239. }
  240. });</code></pre>
  241. <p>
  242. Or a shorthand syntax:<br>
  243. <pre><code>foo.on({
  244. <em>'click'</em> : <b>this</b>.onClick,
  245. <em>'mouseover'</em> : <b>this</b>.onMouseOver,
  246. <em>'mouseout'</em> : <b>this</b>.onMouseOut,
  247. scope: <b>this</b>
  248. });</code></pre></div></li> </ul>
  249. <strong>Returns:</strong>
  250. <ul>
  251. <li><code>void</code></li>
  252. </ul>
  253. </div>
  254. </div>
  255. </div>
  256. </td>
  257. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#addListener" href="output/Ext.util.Observable.html#addListener">Observable</a></td>
  258. </tr>
  259. <tr class="method-row inherited alt expandable">
  260. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  261. <td class="sig">
  262. <a id="Ext.Ajax-fireEvent"></a>
  263. <b>fireEvent</b>(&nbsp;<code>String eventName</code>, <code>Object... args</code>&nbsp;) : Boolean <div class="mdesc">
  264. <div class="short">Fires the specified event with the passed parameters (minus the event name).</div>
  265. <div class="long">
  266. Fires the specified event with the passed parameters (minus the event name). <div class="mdetail-params">
  267. <strong>Parameters:</strong>
  268. <ul><li><code>eventName</code> : String<div class="sub-desc"></div></li><li><code>args</code> : Object...<div class="sub-desc">Variable number of parameters are passed to handlers</div></li> </ul>
  269. <strong>Returns:</strong>
  270. <ul>
  271. <li><code>Boolean</code><div class="sub-desc">returns false if any of the handlers return false otherwise it returns true</div></li>
  272. </ul>
  273. </div>
  274. </div>
  275. </div>
  276. </td>
  277. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#fireEvent" href="output/Ext.util.Observable.html#fireEvent">Observable</a></td>
  278. </tr>
  279. <tr class="method-row inherited expandable">
  280. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  281. <td class="sig">
  282. <a id="Ext.Ajax-hasListener"></a>
  283. <b>hasListener</b>(&nbsp;<code>String eventName</code>&nbsp;) : Boolean <div class="mdesc">
  284. <div class="short">Checks to see if this object has any listeners for a specified event</div>
  285. <div class="long">
  286. Checks to see if this object has any listeners for a specified event <div class="mdetail-params">
  287. <strong>Parameters:</strong>
  288. <ul><li><code>eventName</code> : String<div class="sub-desc">The name of the event to check for</div></li> </ul>
  289. <strong>Returns:</strong>
  290. <ul>
  291. <li><code>Boolean</code><div class="sub-desc">True if the event is being listened for, else false</div></li>
  292. </ul>
  293. </div>
  294. </div>
  295. </div>
  296. </td>
  297. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#hasListener" href="output/Ext.util.Observable.html#hasListener">Observable</a></td>
  298. </tr>
  299. <tr class="method-row inherited alt expandable">
  300. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  301. <td class="sig">
  302. <a id="Ext.Ajax-isLoading"></a>
  303. <b>isLoading</b>(&nbsp;<span class="optional" title="Optional">[<code>Number transactionId</code>]</span>&nbsp;) : Boolean <div class="mdesc">
  304. <div class="short">Determine whether this object has a request outstanding.</div>
  305. <div class="long">
  306. Determine whether this object has a request outstanding. <div class="mdetail-params">
  307. <strong>Parameters:</strong>
  308. <ul><li><code>transactionId</code> : Number<div class="sub-desc">(Optional) defaults to the last transaction</div></li> </ul>
  309. <strong>Returns:</strong>
  310. <ul>
  311. <li><code>Boolean</code><div class="sub-desc">True if there is an outstanding request.</div></li>
  312. </ul>
  313. </div>
  314. </div>
  315. </div>
  316. </td>
  317. <td class="msource"><a ext:cls="Ext.data.Connection" ext:member="#isLoading" href="output/Ext.data.Connection.html#isLoading">Connection</a></td>
  318. </tr>
  319. <tr class="method-row inherited expandable">
  320. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  321. <td class="sig">
  322. <a id="Ext.Ajax-on"></a>
  323. <b>on</b>(&nbsp;<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>, <span class="optional" title="Optional">[<code>Object options</code>]</span>&nbsp;) : void <div class="mdesc">
  324. <div class="short">Appends an event handler to this element (shorthand for addListener)</div>
  325. <div class="long">
  326. Appends an event handler to this element (shorthand for addListener) <div class="mdetail-params">
  327. <strong>Parameters:</strong>
  328. <ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The method the event invokes</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope in which to execute the handler
  329. function. The handler function's "this" context.</div></li><li><code>options</code> : Object<div class="sub-desc">(optional)</div></li> </ul>
  330. <strong>Returns:</strong>
  331. <ul>
  332. <li><code>void</code></li>
  333. </ul>
  334. </div>
  335. </div>
  336. </div>
  337. </td>
  338. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#on" href="output/Ext.util.Observable.html#on">Observable</a></td>
  339. </tr>
  340. <tr class="method-row inherited alt expandable">
  341. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  342. <td class="sig">
  343. <a id="Ext.Ajax-purgeListeners"></a>
  344. <b>purgeListeners</b>() : void <div class="mdesc">
  345. <div class="short">Removes all listeners for this object</div>
  346. <div class="long">
  347. Removes all listeners for this object <div class="mdetail-params">
  348. <strong>Parameters:</strong>
  349. <ul><li>None.</li> </ul>
  350. <strong>Returns:</strong>
  351. <ul>
  352. <li><code>void</code></li>
  353. </ul>
  354. </div>
  355. </div>
  356. </div>
  357. </td>
  358. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#purgeListeners" href="output/Ext.util.Observable.html#purgeListeners">Observable</a></td>
  359. </tr>
  360. <tr class="method-row inherited expandable">
  361. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  362. <td class="sig">
  363. <a id="Ext.Ajax-removeListener"></a>
  364. <b>removeListener</b>(&nbsp;<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>&nbsp;) : void <div class="mdesc">
  365. <div class="short">Removes a listener</div>
  366. <div class="long">
  367. Removes a listener <div class="mdetail-params">
  368. <strong>Parameters:</strong>
  369. <ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The handler to remove</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (this object) for the handler</div></li> </ul>
  370. <strong>Returns:</strong>
  371. <ul>
  372. <li><code>void</code></li>
  373. </ul>
  374. </div>
  375. </div>
  376. </div>
  377. </td>
  378. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#removeListener" href="output/Ext.util.Observable.html#removeListener">Observable</a></td>
  379. </tr>
  380. <tr class="method-row inherited alt expandable">
  381. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  382. <td class="sig">
  383. <a id="Ext.Ajax-request"></a>
  384. <b>request</b>(&nbsp;<span class="optional" title="Optional">[<code>Object options</code>]</span>&nbsp;) : Number <div class="mdesc">
  385. <div class="short">Sends an HTTP request to a remote server.
  386. Important: Ajax server requests are asynchronous, and this call will
  387. return...</div>
  388. <div class="long">
  389. <p>Sends an HTTP request to a remote server.</p>
  390. <p><b>Important:</b> Ajax server requests are asynchronous, and this call will
  391. return before the response has been recieved. Process any returned data
  392. in a callback function. <div class="mdetail-params">
  393. <strong>Parameters:</strong>
  394. <ul><li><code>options</code> : Object<div class="sub-desc">An object which may contain the following properties:<ul>
  395. <li><b>url</b> : String (Optional)<p style="margin-left:1em">The URL to
  396. which to send the request. Defaults to configured URL</p></li>
  397. <li><b>params</b> : Object/String/Function (Optional)<p style="margin-left:1em">
  398. An object containing properties which are used as parameters to the
  399. request, a url encoded string or a function to call to get either.</p></li>
  400. <li><b>method</b> : String (Optional)<p style="margin-left:1em">The HTTP method to use
  401. for the request. Defaults to the configured method, or if no method was configured,
  402. "GET" if no parameters are being sent, and "POST" if parameters are being sent.</p></li>
  403. <li><b>callback</b> : Function (Optional)<p style="margin-left:1em">The
  404. function to be called upon receipt of the HTTP response. The callback is
  405. called regardless of success or failure and is passed the following
  406. parameters:<ul>
  407. <li><b>options</b> : Object<p style="margin-left:1em">The parameter to the request call.</p></li>
  408. <li><b>success</b> : Boolean<p style="margin-left:1em">True if the request succeeded.</p></li>
  409. <li><b>response</b> : Object<p style="margin-left:1em">The XMLHttpRequest object containing the response data. See http://www.w3.org/TR/XMLHttpRequest/ for details about accessing elements of the response.</p></li>
  410. </ul></p></li>
  411. <li><b>success</b> : Function (Optional)<p style="margin-left:1em">The function
  412. to be called upon success of the request. The callback is passed the following
  413. parameters:<ul>
  414. <li><b>response</b> : Object<p style="margin-left:1em">The XMLHttpRequest object containing the response data.</p></li>
  415. <li><b>options</b> : Object<p style="margin-left:1em">The parameter to the request call.</p></li>
  416. </ul></p></li>
  417. <li><b>failure</b> : Function (Optional)<p style="margin-left:1em">The function
  418. to be called upon failure of the request. The callback is passed the
  419. following parameters:<ul>
  420. <li><b>response</b> : Object<p style="margin-left:1em">The XMLHttpRequest object containing the response data.</p></li>
  421. <li><b>options</b> : Object<p style="margin-left:1em">The parameter to the request call.</p></li>
  422. </ul></p></li>
  423. <li><b>scope</b> : Object (Optional)<p style="margin-left:1em">The scope in
  424. which to execute the callbacks: The "this" object for the callback function.
  425. Defaults to the browser window.</p></li>
  426. <li><b>form</b> : Object/String (Optional)<p style="margin-left:1em">A form
  427. object or id to pull parameters from.</p></li>
  428. <li><b>isUpload</b> : Boolean (Optional)<p style="margin-left:1em">True if
  429. the form object is a file upload (will usually be automatically detected).</p></li>
  430. <li><b>headers</b> : Object (Optional)<p style="margin-left:1em">Request
  431. headers to set for the request.</p></li>
  432. <li><b>xmlData</b> : Object (Optional)<p style="margin-left:1em">XML document
  433. to use for the post. Note: This will be used instead of params for the post
  434. data. Any params will be appended to the URL.</p></li>
  435. <li><b>jsonData</b> : Object/String (Optional)<p style="margin-left:1em">JSON
  436. data to use as the post. Note: This will be used instead of params for the post
  437. data. Any params will be appended to the URL.</p></li>
  438. <li><b>disableCaching</b> : Boolean (Optional)<p style="margin-left:1em">True
  439. to add a unique cache-buster param to GET requests.</p></li>
  440. </ul></p>
  441. <p>The options object may also contain any other property which might be needed to perform
  442. postprocessing in a callback because it is passed to callback functions.</p></div></li> </ul>
  443. <strong>Returns:</strong>
  444. <ul>
  445. <li><code>Number</code><div class="sub-desc">transactionId The id of the server transaction. This may be used to cancel the request.</div></li>
  446. </ul>
  447. </div>
  448. </div>
  449. </div>
  450. </td>
  451. <td class="msource"><a ext:cls="Ext.data.Connection" ext:member="#request" href="output/Ext.data.Connection.html#request">Connection</a></td>
  452. </tr>
  453. <tr class="method-row inherited expandable">
  454. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  455. <td class="sig">
  456. <a id="Ext.Ajax-resumeEvents"></a>
  457. <b>resumeEvents</b>() : void <div class="mdesc">
  458. <div class="short">Resume firing events. (see <a ext:cls="Ext.util.Observable" ext:member="suspendEvents" href="output/Ext.util.Observable.html#suspendEvents">suspendEvents</a>)</div>
  459. <div class="long">
  460. Resume firing events. (see <a ext:cls="Ext.util.Observable" ext:member="suspendEvents" href="output/Ext.util.Observable.html#suspendEvents">suspendEvents</a>) <div class="mdetail-params">
  461. <strong>Parameters:</strong>
  462. <ul><li>None.</li> </ul>
  463. <strong>Returns:</strong>
  464. <ul>
  465. <li><code>void</code></li>
  466. </ul>
  467. </div>
  468. </div>
  469. </div>
  470. </td>
  471. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#resumeEvents" href="output/Ext.util.Observable.html#resumeEvents">Observable</a></td>
  472. </tr>
  473. <tr class="method-row alt expandable">
  474. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  475. <td class="sig">
  476. <a id="Ext.Ajax-serializeForm"></a>
  477. <b>serializeForm</b>(&nbsp;<code>String/HTMLElement form</code>&nbsp;) : String <div class="mdesc">
  478. <div class="short">Serialize the passed form into a url encoded string</div>
  479. <div class="long">
  480. Serialize the passed form into a url encoded string <div class="mdetail-params">
  481. <strong>Parameters:</strong>
  482. <ul><li><code>form</code> : String/HTMLElement<div class="sub-desc"></div></li> </ul>
  483. <strong>Returns:</strong>
  484. <ul>
  485. <li><code>String</code></li>
  486. </ul>
  487. </div>
  488. </div>
  489. </div>
  490. </td>
  491. <td class="msource">Ajax</td>
  492. </tr>
  493. <tr class="method-row inherited expandable">
  494. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  495. <td class="sig">
  496. <a id="Ext.Ajax-suspendEvents"></a>
  497. <b>suspendEvents</b>() : void <div class="mdesc">
  498. <div class="short">Suspend the firing of all events. (see <a ext:cls="Ext.util.Observable" ext:member="resumeEvents" href="output/Ext.util.Observable.html#resumeEvents">resumeEvents</a>)</div>
  499. <div class="long">
  500. Suspend the firing of all events. (see <a ext:cls="Ext.util.Observable" ext:member="resumeEvents" href="output/Ext.util.Observable.html#resumeEvents">resumeEvents</a>) <div class="mdetail-params">
  501. <strong>Parameters:</strong>
  502. <ul><li>None.</li> </ul>
  503. <strong>Returns:</strong>
  504. <ul>
  505. <li><code>void</code></li>
  506. </ul>
  507. </div>
  508. </div>
  509. </div>
  510. </td>
  511. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#suspendEvents" href="output/Ext.util.Observable.html#suspendEvents">Observable</a></td>
  512. </tr>
  513. <tr class="method-row inherited alt expandable">
  514. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  515. <td class="sig">
  516. <a id="Ext.Ajax-un"></a>
  517. <b>un</b>(&nbsp;<code>String eventName</code>, <code>Function handler</code>, <span class="optional" title="Optional">[<code>Object scope</code>]</span>&nbsp;) : void <div class="mdesc">
  518. <div class="short">Removes a listener (shorthand for removeListener)</div>
  519. <div class="long">
  520. Removes a listener (shorthand for removeListener) <div class="mdetail-params">
  521. <strong>Parameters:</strong>
  522. <ul><li><code>eventName</code> : String<div class="sub-desc">The type of event to listen for</div></li><li><code>handler</code> : Function<div class="sub-desc">The handler to remove</div></li><li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (this object) for the handler</div></li> </ul>
  523. <strong>Returns:</strong>
  524. <ul>
  525. <li><code>void</code></li>
  526. </ul>
  527. </div>
  528. </div>
  529. </div>
  530. </td>
  531. <td class="msource"><a ext:cls="Ext.util.Observable" ext:member="#un" href="output/Ext.util.Observable.html#un">Observable</a></td>
  532. </tr>
  533. </table>
  534. <a id="Ext.Ajax-events"></a>
  535. <h2>Public Events</h2>
  536. <table cellspacing="0" class="member-table">
  537. <tr>
  538. <th class="sig-header" colspan="2">Event</th>
  539. <th class="msource-header">Defined By</th>
  540. </tr>
  541. <tr class="event-row inherited expandable">
  542. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  543. <td class="sig">
  544. <a id="Ext.Ajax-beforerequest"></a>
  545. <b>beforerequest</b> : (&nbsp;<code>Connection conn</code>, <code>Object options</code>&nbsp;) <div class="mdesc">
  546. <div class="short">Fires before a network request is made to retrieve a data object.</div>
  547. <div class="long">
  548. Fires before a network request is made to retrieve a data object. <div class="mdetail-params">
  549. <strong style="font-weight:normal;">Listeners will be called with the following arguments:</strong>
  550. <ul><li><code>conn</code> : Connection<div class="sub-desc">This Connection object.</div></li><li><code>options</code> : Object<div class="sub-desc">The options config object passed to the <a ext:cls="Ext.data.Connection" ext:member="request" href="output/Ext.data.Connection.html#request">request</a> method.</div></li> </ul>
  551. </div>
  552. </div>
  553. </div>
  554. </td>
  555. <td class="msource"><a ext:cls="Ext.data.Connection" ext:member="#event-beforerequest" href="output/Ext.data.Connection.html#event-beforerequest">Connection</a></td>
  556. </tr>
  557. <tr class="event-row inherited alt expandable">
  558. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  559. <td class="sig">
  560. <a id="Ext.Ajax-requestcomplete"></a>
  561. <b>requestcomplete</b> : (&nbsp;<code>Connection conn</code>, <code>Object response</code>, <code>Object options</code>&nbsp;) <div class="mdesc">
  562. <div class="short">Fires if the request was successfully completed.</div>
  563. <div class="long">
  564. Fires if the request was successfully completed. <div class="mdetail-params">
  565. <strong style="font-weight:normal;">Listeners will be called with the following arguments:</strong>
  566. <ul><li><code>conn</code> : Connection<div class="sub-desc">This Connection object.</div></li><li><code>response</code> : Object<div class="sub-desc">The XHR object containing the response data.
  567. See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
  568. for details.</div></li><li><code>options</code> : Object<div class="sub-desc">The options config object passed to the <a ext:cls="Ext.data.Connection" ext:member="request" href="output/Ext.data.Connection.html#request">request</a> method.</div></li> </ul>
  569. </div>
  570. </div>
  571. </div>
  572. </td>
  573. <td class="msource"><a ext:cls="Ext.data.Connection" ext:member="#event-requestcomplete" href="output/Ext.data.Connection.html#event-requestcomplete">Connection</a></td>
  574. </tr>
  575. <tr class="event-row inherited expandable">
  576. <td class="micon"><a class="exi" href="#expand">&nbsp;</a></td>
  577. <td class="sig">
  578. <a id="Ext.Ajax-requestexception"></a>
  579. <b>requestexception</b> : (&nbsp;<code>Connection conn</code>, <code>Object response</code>, <code>Object options</code>&nbsp;) <div class="mdesc">
  580. <div class="short">Fires if an error HTTP status was returned from the server.
  581. See HTTP Status Code Definitions
  582. for details of HTTP stat...</div>
  583. <div class="long">
  584. Fires if an error HTTP status was returned from the server.
  585. See <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP Status Code Definitions</a>
  586. for details of HTTP status codes. <div class="mdetail-params">
  587. <strong style="font-weight:normal;">Listeners will be called with the following arguments:</strong>
  588. <ul><li><code>conn</code> : Connection<div class="sub-desc">This Connection object.</div></li><li><code>response</code> : Object<div class="sub-desc">The XHR object containing the response data.
  589. See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>
  590. for details.</div></li><li><code>options</code> : Object<div class="sub-desc">The options config object passed to the <a ext:cls="Ext.data.Connection" ext:member="request" href="output/Ext.data.Connection.html#request">request</a> method.</div></li> </ul>
  591. </div>
  592. </div>
  593. </div>
  594. </td>
  595. <td class="msource"><a ext:cls="Ext.data.Connection" ext:member="#event-requestexception" href="output/Ext.data.Connection.html#event-requestexception">Connection</a></td>
  596. </tr>
  597. </table>
  598. </div>