title: how to prevent web pages from being reloaded
body: <pre><code>router.post('/image', upload.any(), function(req, res, next){
    var path = './public/images/';
    var realpath = path + req.files[0].originalname;
    var rename1 = './public/images/' + req.files[0].filename;
    var rename2 = './public/images/' + req.files[0].originalname;
  
    fs.rename(rename1, rename2, function(err){
      if(err){
        console.dir(err);
        res.end();
        return;
      }
      console.dir(&quot;Rename Success!!!&quot;);
  
      fs.readFile(rename2, function(err, data){
        if(err){console.dir(err); return;}
        var tmp = new Buffer(data).toString('base64');
        var url = rename2;
        console.dir(&quot;Send Success&quot;);
        res.redirect(&quot;back&quot;);
        req.socket.emit(&quot;image&quot;, {image : true, buffer : tmp, url : url});
      });
    });
  })
  </code></pre>
  <p>i upload the image file, and socket.emit so client can accept the event and can send image.</p>
  <p>but Problem is that When the image transfer button is pressed, the page is reloaded and the content written on the page disappears.</p>
  <p>How can I prevent the page from being reloaded?
  And how can i keep the page content after uploading the image?</p>
  <p>How can I pass the event back to the socket that uploaded the image?</p>
  <pre><code>&lt;form name='form' method = 'post' action='/image' enctype='multipart/form-data'&gt;
                  &lt;input type=&quot;file&quot; name=&quot;image&quot; id=&quot;imglnp&quot;&gt;
                  &lt;input type=&quot;submit&quot; value=&quot;send image&quot;&gt;
  &lt;/form&gt;
  </code></pre>