This article provides an example of how ext receives json data from an action. For more information about how to receive json data from an action, see ext.
The Code is as follows:
Ext. Ajax. request ({
Method: 'post', // Request method
Params: {dagl_code: dagl_code },
Url: lcwPath + "/daxt/lcgl.shtml? Method = getJgBycode ", // request url
Success: function (response, opts ){
If (response. responseText! = '{}'){
Alert (response. responseText );
// Method 1
Var dagl_jg = Ext. util. JSON. decode (response. responseText). dagl_jg;
// Method 2
Var json = eval ("(" + re. responseText + ")");
Var dagl_jg = json. dagl_jg;
Var org_mc = Ext. util. JSON. decode (response. responseText). org_mc;
Var lccode = Ext. util. JSON. decode (response. responseText). lccode;
Var lcname = Ext. util. JSON. decode (response. responseText). lcname;
Ext. getCmp ("jgs"). comboHidden. setValue (dagl_jg );
Ext. getCmp ('jgs '). setValue (org_mc );
Ext. getCmp ('dagl _ jg'). setValue (dagl_jg );
Ext. getCmp ('sslc '). setValue (lccode );
Ext. getCmp ('sslc '). setRawValue (lcname );
Var dagl_jg = Ext. getCmp ('jggs'). comboHidden. getValue ();
LcStore. proxy = new Ext. data. HttpProxy ({url: lcwPath + '/daxt/lcgl.shtml? Method = getDaxx & dagl_type = L & dagl_jg = '+ dagl_jg });
LcStore. load ();
Ext. getCmp ('lcbh'). setValue ('');
} Else {// no value. Clear the information.
Ext. MessageBox. show ({
Title: 'hup ',
Msg: config. string. NOTNUMBERMSG_OR_NUMBERLOSEEFFICACY,
MinWidth: 270,
Icon: Ext. MessageBox. WARNING,
Buttons: {"OK": "close "},
Fn: function (e) {Ext. MessageBox. hide ();},
Closable: true
});
Ext. getCmp ("jgs"). setValue ("");
Ext. getCmp ("lcbh"). setValue ("");
}
},
Failure: function (response, opts ){
Ext. MessageBox. show ({
Title: 'System prompt ',
Msg: 'unexpected system exception ',
MinWidth: 270,
Icon: Ext. MessageBox. WARNING,
Buttons: {"OK": "close "},
Fn: function (e) {Ext. MessageBox. hide ();},
Closable: true
});
}
});