Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Express + EJS Template] Reload part of HTML rendered page with new elements #774

Open
J0hn3ch opened this issue Oct 16, 2024 · 2 comments

Comments

@J0hn3ch
Copy link

J0hn3ch commented Oct 16, 2024

Hi everyone,

I'm new in web development with Node.js, and I would like to know what is the best way to reload part of rendered HTML page, when I retrieve other information from a database (e.g when perform a fetch with a GET request to retrieve a JSON list of object to visualize in a table).

Are there some best practices in Express or in EJS to handle this kind of behavior?

Thanks in advance!

@J0hn3ch J0hn3ch changed the title [Express + EJS Template] R [Express + EJS Template] Reload part of HTML rendered page with new data Oct 16, 2024
@J0hn3ch J0hn3ch changed the title [Express + EJS Template] Reload part of HTML rendered page with new data [Express + EJS Template] Reload part of HTML rendered page with new elements Oct 16, 2024
@Harshit-Maurya838
Copy link

In order to resolve this issue, update only a part of the webpage without reloading the whole, use AJAX techniques with Fetch API or Axios. You will get the data from your server and update just one portion of your HTML, such as a table, while all the rest remains unchanged on your page.

@J0hn3ch
Copy link
Author

J0hn3ch commented Nov 1, 2024

In order to resolve this issue, update only a part of the webpage without reloading the whole, use AJAX techniques with Fetch API or Axios. You will get the data from your server and update just one portion of your HTML, such as a table, while all the rest remains unchanged on your page.

Do you have any suggestions on how to structure the JavaScript code for the client-side inside the project folders? Are there some best practices on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants