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