I've been messing around with callbacks all day & I can't seem to figure out how to call info
out of callback
. Im using request.js, & I read that there is a callback property but I don't know how to apply it, any input would be appreciated. Here is the code
function add(i, call) {
var options = {
url: 'Hidden' + i,
headers: {
'Authorization': 'Token token="Hidden"'
}
}
function callback(error, response, body) {
var info = JSON.stringify(JSON.parse(body), null, 1);
console.log(info);
}
request(options, callback);
call(info);
}
function apply(data) {
console.log(data)
}
add(1, apply);