Skip to content Skip to sidebar Skip to footer

ExpressJS Change Route Without Refresh

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 i

Solution 1:

you can send the data you need to the client using:

res.send(JSON.stringify(Obj);

and in the ajax success function you need to:

JSON.parse(dataSentFromServer);

and render the data using handlebars in the success function or another function that you call


Solution 2:

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


Post a Comment for "ExpressJS Change Route Without Refresh"