First of all, I have to say that I'm very new to NodeJs, I am rendering a static html web page (which internally executes a javascript code) as a response to a post request and here is my code:
router.post('/', formidable(), function (req, res, next) {
res.sendFile(path.resolve(__dirname+'/../public/result.html'), {}, function (err) {
if (err) {
console.log(err);
}
})});
Now my question is how can interact with the javascript code running on this static page like attaching event handlers to it (for example when the user closes the page)?