title: node.js - global variable not working?
body: <p>I have a problem. The log says that the variable "gData" isnt defined. But in my opinion it must be, because its global? Can you help please?</p>
  
  <pre><code>function refreshGroupData(){
          groupModel.count(function(err, count){
          gData = count;
          io.sockets.emit( 'sendGroupData', gData);
      });
          console.log ('Test: ' + gData);
      }
  </code></pre>
  
  <p>Thanks, Robert.</p>
  
  <p>Edit:</p>
  
  <pre><code>function refreshGroupData(){
          function test(callback){
              groupModel.count(function(err, count){
                  callback(count)
              });
          }
          test(function(count) {
              io.sockets.emit( 'sendGroupData', count);
              console.log('Test: ' + count);
          });
  }
  </code></pre>