AJAX Request in Ext JS:

You can use Ext.Ajax to communicate with server-side code or service in the same domain. Ext.Ajax is a singleton instance of Ext.data.Connection which is main class to setup a connection.

Consider the following example of Ajax request:

            url: '/api/students',
            method: 'GET',
            timeout: 60000,
                id: 1 // loads student whose Id is 1
                'Content-Type': 'application/json'
            success: function (response) {
            failure: function (response) {
                Ext.Msg.alert('Status', 'Request Failed.');


In the above example, we send HTTP GET request to REST api url http://localhost/api/students endpoint using Ext.Ajax.request() method. The url config specifies the endpoint. The method config specifies the HTTP method. It can be GET, POST, PUT, DELETE or other valid HTTP method. The params config specifies the parameter that should go along with HTTP request. The success and failure config is used to specify callback function which will be executed if request executed successfuly or failed.

Please visit Ext.data.Connection and Ext.Ajax for more information.