There's probably an easy answer for this, but I'm trying to get the body of the response back and returned to another function. It's certainly a scope problem.
Here's my code, any ideas would be most appreciated:
var request = require("request");
var myJSON = require("JSON");
function getMyBody(url) {
    var myBody;
    request({
    url: url,
    json: true
    }, function (error, response, body) {
        if (!error && response.statusCode === 200) {
        myBody = body;
    }
 });
return(JSON.parse(myBody));
}
js_traverse(getMyBody(url));
Thanks
Glenn
 
    