title: Get Node.js to get user's input from a HTML text field?
body: <p>I've basically been trying to make a simple game where the user can submit their high-score to a Node.js server. I'm just trying to do something very simple but can't seem to find much to help me online! </p>
  
  <p>At the moment I've got the main page to connect and respond to the server using AJAX.</p>
  
  <p>Here's the HTML:</p>
  
  <pre><code>&lt;div id="test"&gt;&lt;/div&gt; 
  &lt;h3&gt;Upload your high-score:&lt;/h3&gt;
  Your score: &lt;input type="text" name="yourScore"&gt;
  &lt;button id="SubmitBtn" type="submit"&gt;Submit&lt;/button&gt;
  </code></pre>
  
  <p>Here's the JavaScript which triggers when the "Submit" button is clicked and appends the "test" div when successfully connected (Just to show it responds):</p>
  
  <pre><code>&lt;script&gt; 
  $(document).ready(function() {
  $('#SubmitBtn').click(function (event) {
      $.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 connecting to the Node.js server... ' + textStatus + " " + errorThrown); 
          } 
      }); 
  });
  </code></pre>
  
  <p>}); 
    </p>
  
  <p>And here's my Node.js at the moment where it runs and responds:</p>
  
  <pre><code>var http = require('http'); 
  console.log('Game server running...'); 
  http.createServer(function (req, res) { 
  console.log('Submit button has been clicked.'); 
  res.writeHead(200, {'Content-Type': 'text/plain'}); 
  res.end('_testcb(\'{"message": "Welcome! Node.js Responding!"}\')'); 
  }).listen(80); 
  </code></pre>
  
  <p>So yeah, if anyone knows how I can get my Node.js server to read the data in the "yourScore" text field and when the "SubmitBtn" button has been clicked to send the data to the server, I would be most thankful!</p>