I have node.js 5.2.0, expression 4.2.0 and formidable 1.0.17.
I created a simple form to save a text box and a photo. It works fine, but the problem is that after loading the data, I see on the console that the POST is not completed, it is still waiting.
To finish, I added this to my code
form.on('end', function() { res.writeHead(200, {'Content-Type': 'text/plain'}); });
I just want to send headers and nothing on the page. I want the system to get a 200 ok response without printing anything on the page. But the POST is still pending.
How to fix it without typing anything? What headlines should I send?
thanks
UPDATE
If i do
form.on('end', function() { res.end(); });
POST completes normally, but I get a blank page. Why is this? I just want to load some things, not print anything on the page, and not redirect, stay on one page.
Thanks again
source share