0
var Model= function() {
function GetData() {
// Sending the request and i am getting the response.
JsonClientScheduleCareProvider.onload = function() {
return this.responseText;
};
// error handling
JsonClientScheduleCareProvider.onerror = function (e) {
};
return {
GetApps: GetData,
}
}();
在下面的代码中,我进行了JSON调用。如果我得到回复,我应该用回应调用sendData
函数。JSON响应中的回调函数
var jsonData = Model.GetApps();
if (!jsonData) {
Ti.API.warn("JsonData");
SendData(jsonData);
}
我现在面临的问题是jsonData
得到我的回应前,SendData
被调用。我只有在得到响应时才需要执行SendData函数。
这和OP似乎缺少一个'}'。 –
@MattFenwick谢谢。已更新。 – Engineer