How to refresh the page with nodejs after click on submit button
<p>I would need a little help from you.</p>

<p>I have a button which copy something and that "something" should occurs on the page instantly. The problem is that the button has the functionality to copy, but right now I have to refresh the page manually to see the changes. </p>

<p>I dont think this is something tricky but I have tried following without success:</p>

<pre><code>&lt;form method="post" action="/users/copy?scene=&lt;%= scene.id %&gt;"&gt;
  &lt;button type="submit" class="btn btn-primary" onClick="window.location.href=window.location.href"&gt;Copy the scene&lt;/button&gt;
&lt;/form&gt;
</code></pre>

<p>I mean it works if I change <code>"submit"</code> to <code>"button"</code>, but then the functionality to copy something is no longer working.</p>

<p>I googled, but I have not find any answer so far.</p>

<p>Any help would be really appreciated</p>

<p>So I just realized that the localhost was loading even before I added the function to refresh the page so there must be unfinished request on the server. I think it is in this function:</p>

<pre><code>router.post('/copy', function(req,res,call) {

if( req.param('scene') !== undefined ){

db.serialize(function () {

 db.run("CREATE TABLE temp_table as SELECT * FROM scene where id=?", req.param('scene'));
 db.run("UPDATE temp_table SET id = NULL, user_id = (SELECT id FROM users WHERE email =?)",GLOBAL.email);
 db.run("INSERT INTO scene SELECT * FROM temp_table");
 db.run("DROP TABLE temp_table");
 // res.render('copy');
    if(error) {
        console.log(error);
    } 
});

db.close();

 }
 });
</code></pre>