title: how to use jQuery ajax calls with node.js
body: <p>This is similar to <a href="https://stackoverflow.com/questions/2558606/stream-data-with-node-js">Stream data with Node.js</a>, but I don't feel that question was answered sufficiently.</p>
  
  <p>I'm trying to use a jQuery ajax call (get, load, getJSON) to transfer data between a page and a node.js server. I can hit the address from my browser and see 'Hello World!", but when I try this from my page, it fails and shows that I get no response back. I setup a simple test page and hello world example to test this:</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;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Get Test&lt;/h1&gt;
      &lt;div id="test"&gt;&lt;/div&gt;
  
      &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          $(document).ready(function() {
              //alert($('h1').length);
              $('#test').load('http://192.168.1.103:8124/');
              //$.get('http://192.168.1.103:8124/', function(data) {                
              //  alert(data);
              //});
          });
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>var http = require('http');
  
  http.createServer(function (req, res) {
      console.log('request received');
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end('Hello World\n');
  }).listen(8124);
  </code></pre>