title: Extracting data from request/cheerio
body: <p>I'm currently working on a project and have some questions regarding javascript / nodejs / request / cheerio .</p>
  
  <pre><code>request(address , function (error, response, html) {
      if (!error &amp;&amp; response.statusCode == 200) {
        var $ = cheerio.load(html);
        $('iframe').each(function(i, element){
        var a = $(this).attr('src');
  });
  </code></pre>
  
  <p>}
  });</p>
  
  <p>So I'm having above code scraping precisely the data I want from some websites. I want it to render it in some template later. However it seems like var a lives only in the above piece of code, and there's no way to make it global (wouldn't mind it) or somehow return it. Any ideas? </p>