extjs ExtJS AJAX Basic Request


Example

Some of the Class properties Ext.Data.Connection

PropertiesDetails
urlAddress of the request
timeoutWaiting time in milliseconds
successReturn on success
failureReturn 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);
    }
});