Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Newbie: What does Ext.decode do?

Tags:

extjs

extjs3

I have a function:

function openOpportunityHome() {

    showSpinner("Loading.Please wait ");
    Ext.Ajax.request({
                url : contextPath + '/OpportunityTracker.do',
                method : 'POST',
                params : {
                    'role' : SALES_TRACKER_ROLE
        },
                success : function(response, request) {
                    hideSpinner();
                    MD_opportunityMasterDataVO = Ext
                            .decode(response.responseText);
                    ADMIN_OPP_LIST_FLAG =MD_opportunityMasterDataVO.adminOppListFlag;
                    showOpportunitySearch();

                },
                failure : function(response, request) {
                    hideSpinner();
                    ajaxFailureCallbackFn(response, request);
                }
            });
   }

When I call Ext.decode(response.responseText), what exactly happens? Please tell from the perspective of a request/response Scope.

like image 252
SeasonalShot Avatar asked Feb 21 '14 08:02

SeasonalShot


1 Answers

Ext.decode() is just a JSON parser similar to JSON.parse() and parses a string of text into objects you can access in your Javascript.

It's actually an alias for Ext.JSON.decode().

You can read more about it here in the ExtJS documentation.

like image 71
Lloyd Avatar answered Sep 21 '22 15:09

Lloyd