0
我在一个函数中创建了一个AJAX请求。但是,我不知道如何返回JSON结果 - 任何人都可以告诉我如何?如何在Sencha Touch中获得服务器JSON响应?
function getData(arg1, arg2, arg3){
Ext.Ajax.request({
url: 'getData.php',
params: {
arg1: arg1,
arg2: arg2,
arg3: arg3
},
method: 'POST',
success: function(response, opts) {
var jsonData = Ext.util.JSON.decode(response.responseText);
console.log(jsonData); <-- Can see the result here!
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});
return /jsonData/ <-- Here is the value I want?!
}
感谢您的快速反应。是的,我理解你的意思,但我的目标是获得从服务器返回的值,并且此值'jsonData'将用于另一个函数进行计算。我怎样才能做到这一点? – hunteryxx
@ user888022查看更新 – ZenMaster
感谢ZenMaster,我真的很感谢你的解释。有没有机会通过使用商店来完成这种任务? – hunteryxx