Ext front-end receives the json data example passed by action _ extjs

Source: Internet
Author: User
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
});
}

});

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.