基本要求

一些類屬性 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);
    }
});