So... I recently came across this node module: async. I just need a little "show and tell" or a Best Practice approach for the situation I have below. Below you can see my function GetBearerToken
which takes an argument {bearer_token:token}
without an issue.
My issue is the variable ss
. I want to use it outside of this function and pass it to another function to do something. Of course when I try and access ss
, it's undefined. I have tried some of the ways of making this work as indicated in the documentation, but I am apparently missing something. So any help would be great... Thanks
GetBearerToken({
bearer_token: token
}, function(error, result) {
if (error) throw error;
if (result) {
var resultset
var i;
for (i = 0; i < result.length; i++) {
resultset = (simpleObjectify(result[i].meta, result[i].rows))
}
var jstring = JSON.stringify(resultset);
var obj = JSON.parse(jstring);
var ss = obj[0].uuid;
console.log(ss)
})
Outside of function ss
is undefined
.