how to get the server response.responseText after store load extjs 4

Yogendra Singh picture Yogendra Singh · Apr 20, 2012 · Viewed 20.1k times · Source

I'm having one problem with getting the response.responseText from the server response in extjs 4.

Below is my code to load the store:

store.load({
    params: {
        'projectid': this.projectid
    },
    callback: function (records, operation, success, response) {
        console.log(records);
        console.log(response.responseText);
    }
});

Actually, when I made the request with the below function, I properly get the reponse.responseText.

Ext.Ajax.request({
    url: 'login/GetLoginCheck.action',
    method: 'GET',
    params: {
        'username': values['username'],
        'password': values['password']
        },
    scope: this,
    success: function(response) {
        Ext.Msg.alert(response.responseText);
        var redirect = response.responseText;
        window.location.href = "" + redirect + ".jsp";
    },
    failure: function(response) {
        Ext.Msg.alert('INVALID USERNAME OR PASSWORD');
    }
});

So please suggest me how can I get the response.responseText from the store.load() having a callback function.

Answer

scebotari66 picture scebotari66 · Apr 20, 2012

callback has 3 parameters... try this :

store.load({
    params: {
        'projectid': this.projectid
    },
    callback: function (records, operation, success) {
        console.log(operation.response.responseText);
    }
});