Avatar ·

How to update (reload) a page using JavaScript?

Hello everyone! I just started learning JavaScript and encountered this task: after the user clicks the "Submit" button in a form, I need the page to automatically update (reload) — for example, to show new data from the database or reset the form. I tried several options, but nothing works as expected. Here is my code: ```javascript function refreshPage() { // I tried this: window.location.reload(); // And this: location.reload(); // And even this: document.location.reload(true); } ``` But when I call this function on a button click, the page either doesn't reload at all, or it reloads with some strange behavior (for example, it flickers and shows old data). I read that there is also a method `location.relo