0
嗨,我使用下面的代碼在我的手機應用程序發送一個Ajax請求煎茶觸摸 - Ajax請求(JSON響應)
var button = new Ext.Toolbar({
cls: "top_tool_bar2",
height: 35,
items: [this.text,
{xtype: 'spacer'},
{html: new Ext.XTemplate('<img style="width:.5em;height:.5em;" src="resources/imgs/down_arrow.png" />').apply({name: 'down_arrow'}),
handler: function() {
Ext.Ajax.request({
url: '/RadMobApp/api',
params:{
action:'invokeService',
serviceName: 'prescriptionService',
methodName: 'sampleClinicalInfo',
username: 'superuser',
password: 'superuser'
},
success: function(xhr) {
var response = Ext.decode(xhr.responseText);
// alert(response.diagnosis);
}
});
}}
]
});
我得到一個JSON響應,這樣
[{"systemReviewInfoMapListSize":1,"diagnosis":"Impaired hearing\nEarache \nEar noise","isClinicalSummaryAvail":"false","isSymptom":"true","isDiagnosis":"true","symptom":"Impaired hearing\nEarache \nEar noise","isSystemReviewInfo":"true"}]
我該如何閱讀我的應用程序...在此先感謝。
那麼你有一個問題,上面的代碼?是否如預期那樣迴應?你的意思是在我的應用程序中閱讀此內容? – Luis
這是我得到的迴應..我想要得到的價值..通常我們生病得到作爲response.something。這裏我怎麼能得到 – Shakthi
我認爲你是返回數組,不只是普通的對象,所以上面的代碼是正確的。你只應該改變這個'alert(response [0] .diagnosis);'來獲得這個值。 – ilija139