4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/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 {Boolean} disableCaching
87 * True to add a unique cache-buster param to GET requests. Defaults to true.
89 <span id='Ext-Ajax-property-url'> /**
90 </span> * @property {String} url
91 * The default URL to be used for requests to the server.
92 * If the server receives all requests through one URL, setting this once is easier than
93 * entering it on every request.
95 <span id='Ext-Ajax-property-extraParams'> /**
96 </span> * @property {Object} extraParams
97 * An object containing properties which are used as extra parameters to each request made
98 * by this object. Session information and other data that you need
99 * to pass with each request are commonly put here.
101 <span id='Ext-Ajax-property-defaultHeaders'> /**
102 </span> * @property {Object} defaultHeaders
103 * An object containing request headers which are added to each request made by this object.
105 <span id='Ext-Ajax-property-method'> /**
106 </span> * @property {String} method
107 * The default HTTP method to be used for requests. Note that this is case-sensitive and
108 * should be all caps (if not set but params are present will use
109 * <tt>"POST"</tt>, otherwise will use <tt>"GET"</tt>.)
111 <span id='Ext-Ajax-property-timeout'> /**
112 </span> * @property {Number} timeout
113 * The timeout in milliseconds to be used for requests. Defaults to 30000.
116 <span id='Ext-Ajax-property-autoAbort'> /**
117 </span> * @property {Boolean} autoAbort
118 * Whether a new request should abort any pending requests.