Hi i am using the following code to send an ajax request in my mobile application
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);
}
});
}}
]
});
I am getting an JSON response as like this
[{"systemReviewInfoMapListSize":1,"diagnosis":"Impaired hearing\nEarache \nEar noise","isClinicalSummaryAvail":"false","isSymptom":"true","isDiagnosis":"true","symptom":"Impaired hearing\nEarache \nEa开发者_JAVA百科r noise","isSystemReviewInfo":"true"}]
how can i read this in my application... Thanks in advance.
You can try the following:
var data = Ext.JSON.decode(response.responseText.trim());
Assuming your response comes in as such: "id":123, "name": "Mac Arthur" then you should be able to access them like so:
alert("ID: " + data.id + "; Name:" + data.name);
Hope this helps
精彩评论