My Sencha Touch mobile app hits a web service and gets a JSON reponse, I just can't figure out what to DO with it.
Here's my code:
var declineResult = new Ext.regStore('declineResult',
{
model: 'BaseResponse',
proxy : {
type : 'ajax',
dataType: "json",
url : App.BaseURL + '/SetJobResponse/' + options.jobId + '/' + STCID +'/1/' + device.uuid,
reader: new Ext.data.JsonReader ({
type: 'json'
})
},
listeners:
{
load: function(Field1, Field2, Field3, Field4)
{
var myDate = new Date(Field4);
alert('response message:' + Field1 + ',' + Field2 + ',' + Field3 + ',' + Field4 + ',' + myDate.getDate());
}
}
});
Ext.StoreMgr.get("declineResult").load();
Browsing to the URL gives:
{"ErrorMessage":"You are not authorised","ResponseTime":"\/Date(1321447985287)\/","StatusCode":401,"Success":false}
But no matter what I do, I can't get anything meaningful to come up in the alert(). I've tried converting to various data types, JSON parsing, getValue() and new String(Field1) and every similar function under the sun. all I get is [object Object] or NaN. I can't even be sure which field is which.
Every example on the internet seems to assume you're just plugging it into a grid or something. How do I interrogate these fields?