Hey I have a website run with Express.js and Handlebars that has a navbar and sidebar that stays the same for all the pages. When I route it only changes the page container which is {{{body}}}
.
Is there a way I can just load the content of the routes without the page actually refreshing and reloading the nav and sidebar?
I'm currently using this for routing.
router.get('/', checkAuthentication, function(req, res){
res.render('index');
});
Any help would be nice as I'm quite new with node.
I want only the container to load not the whole url/page
you can send the data you need to the client using:
and in the ajax success function you need to:
and render the data using handlebars in the success function or another function that you call
Thank you all for considering/looking at the post, i have come to the conclusion to be using PJAX to do this.
The tutorial i read, for anyone wondering is : Pjax Tutorial