1
app.get('/', function (req, res) {
    res.render('home.jade', {
        results: req.session.value
    });
});

What i would like know is whether i can use jade to display req.session.value in the html when it has been given a value after i have triggered an event without refreshing the page.

    script
        function sendRequest() {
            var socket = io.connect();
            socket.on('value set', function(data){
            //jade code goes here
            });
           //i gave query a value here
        socket.emit('fire event', query);
        }
Aldon Palmer
  • 182
  • 2
  • 12

1 Answers1

0

"jade" can't do anything to dynamically update your page, the end result of a jade template is static html. If you want to update the page on that 'value set' event from socket.io you'll need to just use javascript, grab the element, and update it's value. Whatever client-side javascript library you're using should make this simple enough.

Brad Harris
  • 1,520
  • 9
  • 12