How to change dynamic content in a popup window without refreshing the page so the popup stays opened

I’ve been learning the basics of programming for a while and now I’m doing my little project to try out my knowledge of SQL and some EJS with it.

Basically, I’m trying to simply show tasks that a user creates, which you can open by clicking on them into a popup window. In that popup, I want the user to be able to add/remove notes by clicking on buttons but without refreshing the page so the popup stays opened. After the user want to update or create the task, the app should check if there are any notes(elements created by those buttons) and store them into a SQL table so they appear there next time the user opens the task popup.

I’ve tried to create a notes SQL table, but after the add note button was clicked and it wanted to update the table, the page was refreshed and the popup would close.

I’m thinking of making an array that would store the SQL table data and dynamically push into the array an input value that the user has entered and maybe after the update task button was clicked it would then update the sql tables but I am not sure where to create the table, if in the index.js file or in the home.ejs file in a script tag..

main page where all of the tasks created are displayed

displayed task

]