I am writing a game server, where players enter a game room, then get paired with another player. I would at this point like to display the board without reloading the page, so I do not have to reinitiate the socket.
in app.js file
socket.on('challangeExcepted', function(playerToMatch){
if(socket.player.id == playerToMatch.id){
ejs.render('board', {
units: 19,
length: 600
});
}
});
However I cannot seem to get this to work. Am I doing something wrong, or is this just not possible?
As far as I can tell to completely change the html requires the page to be reloaded. You can however update the dynamic parts of your template using
res.update('page_element', '/template.ejs', '{whatever: 'you want to update'});Here is the documentation
http://code.google.com/p/embeddedjavascript/wiki/Templates
I ended up just using backbone.js to solve my problem which allows for large changes to the html without reloading the page.