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,
}
}();
In the below code I make my JSON Call. If I get the response, I should call the sendData function with the response.
var jsonData = Model.GetApps();
if (!jsonData) {
Ti.API.warn("JsonData");
SendData(jsonData);
}
The problem I am facing is before the jsonData gets me the response, the SendData is called. I need to execute the SendData function only when I get the response.
You need to wait untill your response will be delivered. For this purpose use
callbackfunction.Try something like this: