I'm trying to return value of pagenumber
from inner function to another. But due to asynchronous nature of javascript. I'm unable to do it as outer function gets executed earlier as compared to inner one. I'm trying to use callback to it but it will produce error if i call outer function(from somewhere else) without callback. My code is,
'GrabNewResponse':function(credentials,width){
let pagenumber=0;
app.request.get(url,function(data){
let result=JSON.parse(data);
pagenumber=result.data.pagenumber;
if(result.success===true){
app.dialog.close();
}
});
return pagenumber;
},