title: Node JS return undefined?
body: <p>I am using a basic node.js introduction script, and i am passing in a argument in the command line.
  i want this argument to be passed back to the client after it has run. I can pass back anything that is pure text or values, but i can't pass back a variable containing the same information.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
    &lt;head&gt;
    &lt;meta charset="utf-8"/&gt;
    &lt;title&gt;get test&lt;/title&gt;
    &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"&gt;
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1&gt;Get Test&lt;/h1&gt;
    &lt;div id="test"&gt;&lt;/div&gt;
    &lt;script&gt;
      $(document).ready(function() {
        $.ajax({url: 'http://localhost',dataType: "jsonp",jsonpCallback: "_testcb",cache: false,timeout: 5000,success: function(data) {
            $("#test").append(data);
          },
          error: function(jqXHR, textStatus, errorThrown) {
            alert('error ' + textStatus + " " + errorThrown);
          }
        });
      });
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And this is my server code:</p>
  
  <pre><code>var http = require('http');
  var arr = new Array();
  http.createServer(function (req, res) {
    res.writeHead(200);
  
    // print process.argv
    process.argv.forEach(function(val, index, array) {
      console.log(index + ': ' + val);
      arr[index] = val;
      res.write("Size" + val);
      res.end('_testcb(\'{"Size: \' + val + \'"}\')');
    });
  
  
    console.log(arr[2]);
  }).listen(80);
  </code></pre>
  
  <p>So my question is, how do i pass back objects/ variables/ arrays rather than static text?</p>