extjs

ExtJS AJAX

Introduction#

A singleton instance of an Ext.data.Connection class. This class is used to communicate with your server side.

Basic Request

Some of the Class properties Ext.Data.Connection

Properties Details
url Address of the request
timeout Waiting time in milliseconds
success Return on success
failure Return on 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);
    }
});

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow