There are many ways to do this, and it is not immediately clear which approach you want to take.
I assume that the simplest scenario would be to add some client logic to extract html fragments from the server and update the client. This is easily achieved using jQuery (put it inside the block of the finished document to connect the event):
$('#button').click(function() { $.get('/some/url', {foo: 42}, function(result) { $('#target').html(result); } }
This way all your html is created on the server, and you simply extract and paste it into the page as needed.
You can also get json from the server and display html on the client, but this is one of the alternative approaches. I highly recommend giving TodoMVC a look - this is a to-do list application with many different implementations (each using a different structure) and, therefore, an excellent learning resource for various approaches and supporting libraries.
I also recommended Practical Node.js. This will help you understand routing and how to get started with Node.
Morten mertner
source share