4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-Ajax'>/**
19 </span> * @class Ext.Ajax
22 * @extends Ext.data.Connection
24 A singleton instance of an {@link Ext.data.Connection}. This class
25 is used to communicate with your server side code. It can be used as follows:
32 success: function(response){
33 var text = response.responseText;
34 // process server response here
38 Default options for all requests can be set by changing a property on the Ext.Ajax class:
40 Ext.Ajax.timeout = 60000; // 60 seconds
42 Any options specified in the request method for the Ajax request will override any
43 defaults set on the Ext.Ajax class. In the code sample below, the timeout for the
44 request will be 60 seconds.
46 Ext.Ajax.timeout = 120000; // 120 seconds
52 In general, this class will be used for all Ajax requests in your application.
53 The main reason for creating a separate {@link Ext.data.Connection} is for a
54 series of requests that share common settings that are different to all other
55 requests in the application.
58 Ext.define('Ext.Ajax', {
59 extend: 'Ext.data.Connection',
62 <span id='Ext-Ajax-cfg-url'> /**
63 </span> * @cfg {String} url @hide
65 <span id='Ext-Ajax-cfg-extraParams'> /**
66 </span> * @cfg {Object} extraParams @hide
68 <span id='Ext-Ajax-cfg-defaultHeaders'> /**
69 </span> * @cfg {Object} defaultHeaders @hide
71 <span id='Ext-Ajax-cfg-method'> /**
72 </span> * @cfg {String} method (Optional) @hide
74 <span id='Ext-Ajax-cfg-timeout'> /**
75 </span> * @cfg {Number} timeout (Optional) @hide
77 <span id='Ext-Ajax-cfg-autoAbort'> /**
78 </span> * @cfg {Boolean} autoAbort (Optional) @hide
81 <span id='Ext-Ajax-cfg-disableCaching'> /**
82 </span> * @cfg {Boolean} disableCaching (Optional) @hide
85 <span id='Ext-Ajax-property-disableCaching'> /**
86 </span> * @property disableCaching
87 * True to add a unique cache-buster param to GET requests. (defaults to true)
90 <span id='Ext-Ajax-property-url'> /**
91 </span> * @property url
92 * The default URL to be used for requests to the server. (defaults to undefined)
93 * If the server receives all requests through one URL, setting this once is easier than
94 * entering it on every request.
97 <span id='Ext-Ajax-property-extraParams'> /**
98 </span> * @property extraParams
99 * An object containing properties which are used as extra parameters to each request made
100 * by this object (defaults to undefined). Session information and other data that you need
101 * to pass with each request are commonly put here.
104 <span id='Ext-Ajax-property-defaultHeaders'> /**
105 </span> * @property defaultHeaders
106 * An object containing request headers which are added to each request made by this object
107 * (defaults to undefined).
110 <span id='Ext-Ajax-property-method'> /**
111 </span> * @property method
112 * The default HTTP method to be used for requests. Note that this is case-sensitive and
113 * should be all caps (defaults to undefined; if not set but params are present will use
114 * <tt>"POST"</tt>, otherwise will use <tt>"GET"</tt>.)
117 <span id='Ext-Ajax-property-timeout'> /**
118 </span> * @property timeout
119 * The timeout in milliseconds to be used for requests. (defaults to 30000)
123 <span id='Ext-Ajax-property-autoAbort'> /**
124 </span> * @property autoAbort
125 * Whether a new request should abort any pending requests. (defaults to false)