Home > database >  Is it possible to change some content of a view without completely re-render it in express.js
Is it possible to change some content of a view without completely re-render it in express.js

Time:12-11

I am currently making a calendar where users can click on dates, and a popup window then shows the events of the date that user clicked at. However, we don't know which date the user will be clicked at before rendering, the content of the window cannot be determined. Is there any way I can dynamically change the content of an element after a user action ("click" or "hover") in Express.js?

CodePudding user response:

Yeah, make a separate API route that returns JSON and fetch it using client side JS and integrate it into the page without a reload.

This is a very common pattern in React.

Also this method is called AJAX, so you might look that up too!

CodePudding user response:

Is there any way I can dynamically change the content of an element after a user action ("click" or "hover")

That would be the responsibility of client-side javascript. It seems like you need a in the html file your express code is serving.

  • Related