title: SyntaxError: Unexpected token in node.js
body: <p>Am using following code to fetch data from server .but in place of </p>
  
  <pre><code>var  jobData = JSON.parse(data);
  </code></pre>
  
  <p>Am getting </p>
  
  <pre><code>undefined:1
  1afcec877d925d110","date":"Mon Jan 06 2014 09:33:13 GMT+0530 (IST)","id":"51",
                                                                                ^
  SyntaxError: Unexpected end of input
      at Object.parse (native)
  </code></pre>
  
  <p>code </p>
  
  <pre><code>var options = {
                      host: '172.16.2.120',
                      path: '/getModes?mode=' + jobLists,
                      port: '8080',
                      method: 'GET'
                  };
  
                  var reqOs = http.request(options, function (resOs) {
                      resOs.on('data', function (data) {              
                     var jobData = JSON.parse(data);              
                      });
                      resOs.on('end', function () {           
  
                      });
                  });
                  reqOs.on('error', function (e) {
                      console.log('problem with request: ' + e.message);
                  });
                  reqOs.end(''); 
  </code></pre>