基本要求
一些类属性 Ext.Data.Connection
属性 | 细节 |
---|---|
url |
请求的地址 |
timeout |
等待时间,以毫秒为单位 |
success |
成功回归 |
failure |
失败时返回 |
Ext.Ajax.on("beforerequest", function(conn , options , eOpts) {
console.log("beforerequest");
});
Ext.Ajax.on("requestcomplete", function(conn , response , options , eOpts) {
console.log("requestcomplete");
});
Ext.Ajax.on("requestexception", function(conn , response , options , eOpts) {
console.log("requestexception");
});
Ext.Ajax.request({
url: 'mypath/sample.json',
timeout: 60000,
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
console.log(obj);
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});