<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<title>The source code</title>
|
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
|
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
|
<style type="text/css">
|
.highlight { display: block; background-color: #ddd; }
|
</style>
|
<script type="text/javascript">
|
function highlight() {
|
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
|
}
|
</script>
|
</head>
|
<body onload="prettyPrint(); highlight();">
|
<pre class="prettyprint lang-js"><span id='Ext-Ajax'>/**
|
</span> * @class Ext.Ajax
|
* @singleton
|
* @markdown
|
|
A singleton instance of an {@link Ext.data.Connection}. This class
|
is used to communicate with your server side code. It can be used as follows:
|
|
Ext.Ajax.request({
|
url: 'page.php',
|
params: {
|
id: 1
|
},
|
success: function(response){
|
var text = response.responseText;
|
// process server response here
|
}
|
});
|
|
Default options for all requests can be set by changing a property on the Ext.Ajax class:
|
|
Ext.Ajax.timeout = 60000; // 60 seconds
|
|
Any options specified in the request method for the Ajax request will override any
|
defaults set on the Ext.Ajax class. In the code sample below, the timeout for the
|
request will be 60 seconds.
|
|
Ext.Ajax.timeout = 120000; // 120 seconds
|
Ext.Ajax.request({
|
url: 'page.aspx',
|
timeout: 60000
|
});
|
|
In general, this class will be used for all Ajax requests in your application.
|
The main reason for creating a separate {@link Ext.data.Connection} is for a
|
series of requests that share common settings that are different to all other
|
requests in the application.
|
|
*/
|
Ext.define('Ext.Ajax', {
|
extend: 'Ext.data.Connection',
|
singleton: true,
|
|
<span id='Ext-Ajax-cfg-extraParams'> /**
|
</span> * @cfg {Object} extraParams @hide
|
*/
|
<span id='Ext-Ajax-cfg-defaultHeaders'> /**
|
</span> * @cfg {Object} defaultHeaders @hide
|
*/
|
<span id='Ext-Ajax-cfg-method'> /**
|
</span> * @cfg {String} method @hide
|
*/
|
<span id='Ext-Ajax-cfg-timeout'> /**
|
</span> * @cfg {Number} timeout @hide
|
*/
|
<span id='Ext-Ajax-cfg-autoAbort'> /**
|
</span> * @cfg {Boolean} autoAbort @hide
|
*/
|
<span id='Ext-Ajax-cfg-disableCaching'> /**
|
</span> * @cfg {Boolean} disableCaching @hide
|
*/
|
|
<span id='Ext-Ajax-property-disableCaching'> /**
|
</span> * @property {Boolean} disableCaching
|
* True to add a unique cache-buster param to GET requests. Defaults to true.
|
*/
|
<span id='Ext-Ajax-property-url'> /**
|
</span> * @property {String} url
|
* The default URL to be used for requests to the server.
|
* If the server receives all requests through one URL, setting this once is easier than
|
* entering it on every request.
|
*/
|
<span id='Ext-Ajax-property-extraParams'> /**
|
</span> * @property {Object} extraParams
|
* An object containing properties which are used as extra parameters to each request made
|
* by this object. Session information and other data that you need
|
* to pass with each request are commonly put here.
|
*/
|
<span id='Ext-Ajax-property-defaultHeaders'> /**
|
</span> * @property {Object} defaultHeaders
|
* An object containing request headers which are added to each request made by this object.
|
*/
|
<span id='Ext-Ajax-property-method'> /**
|
</span> * @property {String} method
|
* The default HTTP method to be used for requests. Note that this is case-sensitive and
|
* should be all caps (if not set but params are present will use
|
* <tt>"POST"</tt>, otherwise will use <tt>"GET"</tt>.)
|
*/
|
<span id='Ext-Ajax-property-timeout'> /**
|
</span> * @property {Number} timeout
|
* The timeout in milliseconds to be used for requests. Defaults to 30000.
|
*/
|
|
<span id='Ext-Ajax-property-autoAbort'> /**
|
</span> * @property {Boolean} autoAbort
|
* Whether a new request should abort any pending requests.
|
*/
|
autoAbort : false
|
});
|
</pre>
|
</body>
|
</html>
|