Java script function return undefined
Content
Hello All,
My use case consists 1 function to call another function in js. But it keep returning undefined.
I would like to know if i need to do a conversation or to get a work around.
Please check sample code below and attached alert sreenshot
PageModule.prototype.getResult1 = function () {
var ep = Rest.get('role/getGetRole');
var returnVal = 'Success';
ep.fetch().then(function (result) {
if (result.response.ok) {
alert(result.body.count); //pass
var resultResult = result.body.count;
if (result.body.count == 4) {//pass
return returnVal;// returnVal is undefined!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
return 'Not OK';
}
else {
return null;
}
});
};
PageModule.prototype.getResult1Value = function (arg1)
Tagged:
1