我正在使用sencha touch。我用它示例json url。我得到了一個成功的結果,但我沒有得到字符串的響應值。Sench Touch Json獲取字符串響應?
我在這裏使用代碼:
Ext.data.JsonP.request({
url : 'http://webapps.figleaf.com/arch101/dataservices/mobile/beer.cfc?method=getExcuses',
method: 'GET',
params: {
},
success: function(response) {
// this will give you the JSON
Ext.Msg.alert('Success', response.responseText);
},
failure: function(response) {
Ext.Msg.alert('Error', 'Please try again.', response.responseText);
}
});
我希望得到如下回應
foo([
{"EXCUSE":"I accidentally flushed my wallet down the toilet."},
{"EXCUSE":"I ran out of water."},
{"EXCUSE":"The Jets lost again"},
{"EXCUSE":"I'm on a mission from God"},
{"EXCUSE":"It was only one sheep..."},
{"EXCUSE":"I think that I left my smartphone at your place"},
{"EXCUSE":"My plants are all dying. I think they crave beer."},
{"EXCUSE":"I need to listen to your Tito Puente albums."},
{"EXCUSE":"I just found out that Darth Vader is Luke's father."},
{"EXCUSE":"Sorry, I accidentally butt-dialed you. But since you have time to answer the phone, mind if I come over for a bit?"},
{"EXCUSE":"I ran out of bacon and the stores are all out!"},
{"EXCUSE":"Someone stole the cork from my lunch."},
{"EXCUSE":"My girlfriend is preggers."},
{"EXCUSE":"My girlfriend is preggers"},
{"EXCUSE":"Yeast! If I don't get yeast within 30 minutes Ill suffer a brain aneurism."},
{"EXCUSE":"I heard you had beer. Mind if I come over? I'm on my way over now, assuming you'll say yes. Thanks in advance!"},
{"EXCUSE":"I heard you had beer. Mind if I come over? I'm on my way over now, assuming you'll say yes. Thanks in advance!"},
{"EXCUSE":"You said tonight was our Battlestar Galactica marathon...?"},
{"EXCUSE":"My parents are coming over."},
{"EXCUSE":"I have plenty of bacon...but no beer. Can I come over?"},
{"EXCUSE":"I left my iPhone 5 charger at my brothers and I don't have enough time to wait at the Apple store to get a new one."}
])
對不起,我並不完全清楚。你是否在響應中將這個數組作爲字符串? – benka
嗨benda.i想獲得價值。 – Gomathi
本達我只想顯示響應值。之後,我實現了數組並獲取詳細信息。但是我無法獲得響應值 – Gomathi