ext前臺(tái)接收action傳過來的json數(shù)據(jù)示例
更新時(shí)間:2014年06月17日 17:44:37 投稿:whsnow
這篇文章以示例的方式為大家介紹了ext前臺(tái)接收action傳過來的json數(shù)據(jù),需要的朋友可以參考下
ext前臺(tái)接收action傳過來的json數(shù)據(jù)
Ext.Ajax.request({
method:'POST',//請(qǐng)求方式
params : {dagl_code:dagl_code},
url:lcwPath+"/daxt/lcgl.shtml?method=getJgBycode",//請(qǐng)求的url地址
success: function(response, opts) {
if(response.responseText!='{}'){
alert(response.responseText);
<span style="BACKGROUND-COLOR: #ffcc99">//第一種方法
var dagl_jg = Ext.util.JSON.decode(response.responseText).dagl_jg;
//第二種方法
var json = eval("(" + re.responseText + ")");
var dagl_jg= json.dagl_jg;
</span>
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('jgs').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{//值沒有,清空信息
Ext.MessageBox.show({
title:'提示',
msg:config.string.NOTNUMBERMSG_OR_NUMBERLOSEEFFICACY,
minWidth:270,
icon:Ext.MessageBox.WARNING,
buttons:{"ok":"關(guān)閉"},
fn:function(e){Ext.MessageBox.hide();},
closable:true
});
Ext.getCmp("jgs").setValue("");
Ext.getCmp("lcbh").setValue("");
}
},
failure: function(response, opts) {
Ext.MessageBox.show({
title:'系統(tǒng)提示',
msg:'系統(tǒng)出現(xiàn)非預(yù)期異常',
minWidth:270,
icon:Ext.MessageBox.WARNING,
buttons:{"ok":"關(guān)閉"},
fn:function(e){Ext.MessageBox.hide();},
closable:true
});
}
});
復(fù)制代碼 代碼如下:
Ext.Ajax.request({
method:'POST',//請(qǐng)求方式
params : {dagl_code:dagl_code},
url:lcwPath+"/daxt/lcgl.shtml?method=getJgBycode",//請(qǐng)求的url地址
success: function(response, opts) {
if(response.responseText!='{}'){
alert(response.responseText);
<span style="BACKGROUND-COLOR: #ffcc99">//第一種方法
var dagl_jg = Ext.util.JSON.decode(response.responseText).dagl_jg;
//第二種方法
var json = eval("(" + re.responseText + ")");
var dagl_jg= json.dagl_jg;
</span>
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('jgs').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{//值沒有,清空信息
Ext.MessageBox.show({
title:'提示',
msg:config.string.NOTNUMBERMSG_OR_NUMBERLOSEEFFICACY,
minWidth:270,
icon:Ext.MessageBox.WARNING,
buttons:{"ok":"關(guān)閉"},
fn:function(e){Ext.MessageBox.hide();},
closable:true
});
Ext.getCmp("jgs").setValue("");
Ext.getCmp("lcbh").setValue("");
}
},
failure: function(response, opts) {
Ext.MessageBox.show({
title:'系統(tǒng)提示',
msg:'系統(tǒng)出現(xiàn)非預(yù)期異常',
minWidth:270,
icon:Ext.MessageBox.WARNING,
buttons:{"ok":"關(guān)閉"},
fn:function(e){Ext.MessageBox.hide();},
closable:true
});
}
});
相關(guān)文章
extjs中g(shù)rid中嵌入動(dòng)態(tài)combobox的應(yīng)用
今天需要在grid中嵌入combobox,在網(wǎng)上找了好久也沒有找到一個(gè)正確可行的方法,可能是版本問題(我版本是extjs 3.0),沒有繼續(xù)研究其原因,自己查找資料,終于實(shí)現(xiàn)功能?,F(xiàn)在分享一下代碼。2011-01-01
extjs3 combobox取value和text案例詳解
使用combobox時(shí),它有一個(gè)hiddenName的屬性,專門用于提交combobox中value的值,接下來介紹extjs3 combobox如何取value和text值,感興趣的朋友可以不要錯(cuò)過了啊2013-02-02
Extjs學(xué)習(xí)筆記之九 數(shù)據(jù)模型(上)
本文開始進(jìn)入Extjs最核心最優(yōu)秀的部分。2010-01-01
Extjs4中的分頁(yè)應(yīng)用結(jié)合前后臺(tái)
本文為大家介紹下Extjs4中的分頁(yè)如何使用且結(jié)合前后臺(tái),具體的示例如下,感興趣的朋友可以參考下2013-12-12
Extjs NumberField后面加單位實(shí)現(xiàn)思路
本文為大家介紹下在NumberField后面加單位,具體實(shí)現(xiàn)如下,感興趣的朋友可以參考下2013-07-07
ExtJS4給Combobox設(shè)置列表中的默認(rèn)值示例
這篇文章主要介紹了ExtJS4如何給Combobox設(shè)置列表中的默認(rèn)值,需要的朋友可以參考下2014-05-05
ExtJS Ext.MessageBox.alert()彈出對(duì)話框詳解
Ext.MessageBox是一個(gè)工具類,他繼承自O(shè)biect對(duì)象,用來生成各種風(fēng)格的信息提示對(duì)話框,Ext.Msg是該類的別名,使用Ext.MessageBox和用Ext.Msg效果是一樣的,而后者提供了更簡(jiǎn)單的方式。2010-04-04

