title: node.js request object- return response body for further operation
body: <p>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.  </p>
  
  <p>Here's my code, any ideas would be most appreciated:</p>
  
  <pre><code>var request = require("request");
  var myJSON = require("JSON");
  
  function getMyBody(url) {
      var myBody;
      request({
      url: url,
      json: true
      }, function (error, response, body) {
          if (!error &amp;&amp; response.statusCode === 200) {
          myBody = body;
      }
   });
  
  return(JSON.parse(myBody));
  </code></pre>
  
  <p>}</p>
  
  <pre><code>js_traverse(getMyBody(url));
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Glenn</p>