Kapil
Kapil

Reputation: 832

Retrieve data from a JsonP proxy in sencha touch

I am trying to get the data from a JSONP proxy in sencha touch 2.3(I am using sencha architect 3 to develop). I was successfully able to place jsonp call and get the data back. But I am not getting how to separate every single element of json response. Here is my json Response:-

{"data":[{   "PLANTNUM": "1557",   "ROUTEID": "90625",   "DELIVERYDATE": "2014-02-12T00:00:00-06:00",   "MESCOD": "15",   "MESFCT": "DLV",   "ORIGID": "HH",      "JMSTIME": "02/11/2014 00:11:21",   }],"success" : true}

Here is my function

 success: function(response){
console.log(response);
    var temp=response.data.PLANTNUM;
    console.log(temp);
}

I can see below in my console:-

console

Here is my jsonP request

Ext.data.JsonP.request({
url: 'http://localhost:12608',
callbackKey: 'cbfn',
params: {
    method: 'sapout',
    type: 'sap', 
    ordnum: '1034986850'
}

I tried using response.PLANTNUM but that is also not working. It always shows undefined Can anyone help me out here.

Thanks

Upvotes: 0

Views: 379

Answers (1)

Evan Trimboli
Evan Trimboli

Reputation: 30092

data is an array, so you want response.data[0].PLATINUM.

Upvotes: 2

Related Questions