0
我是Sencha新手,正在從服務器讀取響應JSON數據並在警報中顯示,但在響應中,handleSuccess函數正在執行並獲取警報中的數據未定義。所以我希望JSON中的消息數據顯示在警報中。感謝您的幫助。從服務器如何讀取Sencha觸摸服務器中的響應json數據
JSON數據:
{ 「數據」:[{ 「成功」: 「FALSE」, 「消息」: 「數據加載」, 「groupCount」:0 「maxSeverity」: 10}]}
Ext.Ajax.request({
url: 'serverurl',
headers: { 'Content-Type': 'application/json;charset=utf-8' },
params: {
username: 'username',
password: 'password'
},
method: 'GET',
success: handleSuccess,
failure: handleError
});
function handleSuccess(response, opts)
{
var jsonData = Ext.decode(response.Message);
alert(jsonData)
}
function handleError(response, opts)
{
alert('server-side failure with status code ' + response.status);
}