title: ClientJade - Trouble executing jade.render()
body: <p>I've run into a problem in the clientside code for a Node.js app I'm working on.<br>
  The idea behind this is to update the browser immediately as the socket receives an event.</p>
  
  <p>This is the script block on the client side:</p>
  
  <pre><code>script(src='/scripts/jadeTemplate.js')
  script(src='/socket.io/socket.io.js')
  script(type='text/javascript')
    var socket = io.connect();
    socket.on('obj', function(obj) {
      var newsItem = document.createElement("item");
      jade.render(newsItem, 'objTemplate', { object: obj });
      $('#newsfeed').prepend(newsItem);
      alert(obj);
    });
  </code></pre>
  
  <p>When the <code>alert()</code> is placed before the <code>jade.render()</code>, it alerts, but if inserted after, it doesn't execute (hence, I think it's a problem with the <code>jade.render()</code>).</p>
  
  <p>This is objTemplate.jade, referred to in line 7:</p>
  
  <pre><code>p #{object}
  // That's it.
  </code></pre>
  
  <p>And this is a relevant snippet from the app.js:</p>
  
  <pre><code>var server = dgram.createSocket('udp4');
  server.bind(41234);
  server.on('message', function(buf, rinfo) {
      isOnline = true;
      var message = buf.toString();
      io.sockets.emit('obj', message);
  });
  </code></pre>
  
  <hr>
  
  <p>UPDATE:</p>
  
  <p><a href="http://pastebin.com/h8CwqFgD" rel="nofollow">Here's a link</a> to <code>/public/scripts/jadeTemplate.js</code>, which IMO is too long of a snippet for a question.</p>
  
  <p>If I need to provide any more snippets or files let me know. :)</p>