title: socket.io and node js: chat does not display on screen
body: <p>I was giving a try to socket.io by creating a live chat, and the page refreshes itself when the message is submitted, here is the markup and the client side JS (index.html):</p>
  
  <pre><code>&lt;body&gt;
      &lt;h1&gt;Open chat&lt;/h1&gt;
  
      &lt;form id="send_message"&gt;
          &lt;div class="chat"&gt;
  
          &lt;/div&gt;
          &lt;hr /&gt;
          &lt;input size="28" type="text" id="message" /&gt;
          &lt;input type="submit" value="send" /&gt;
      &lt;/form&gt;
  
      &lt;script src="http://code.jquery.com/jquery-latest-min.js"&gt;&lt;/script&gt;
      &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
      &lt;script&gt;
          JQuery(function($){
              var socket = io.connect();
              var $message_form = $('#send_message');
              var $message_box = $('#message');
              var $chat = $('#chat');
  
              $message_form.submit(function(e){
                  e.preventDefault();
                  socket.emit('send message', $message_box.val());
                  $message_box.val('');                   
              })
          });
  
          socket.on('new message', function(data){
              $chat.append(data+'&lt;br /&gt;');
          });
      &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>and here is the server side js (app.js):</p>
  
  <pre><code>var express = require('express'),
  app = express(),
  server = require('http').createServer(app),
  io = require('socket.io').listen(server);
  
  server.listen(3000);
  
  app.get('/',function(req, res){
      res.sendfile(__dirname + '/index.html');
  });
  
  io.sockets.on('connection',function(socket){
      socket.on('send message', function(data){
          io.sockets.emit('new message',data);
      });
  });
  </code></pre>
  
  <p>I know you guys won't need this but this is package.json:</p>
  
  <pre><code>{
  "name":"test_chat_application",
  "version":"0.0.1",
  "private":"true",
  "dependencies":{
      "socket.io":"1.4.8",
      "express":"4.14.0"
  }
  </code></pre>
  
  <p>}</p>
  
  <p>basically i think the problem is the page refresh!
  please help..</p>