Camilo Morales Camilo Morales - 1 year ago 75
Node.js Question

How finish res without change page?


the result is a blank page, so how to finish without changing the page? My code is the following:'/subirArchivo/:idProducto', function (req, res){
var idProducto = req.params.idProducto;
var form = new formidable.IncomingForm();
var dir = '../../../../uploads/'+idProducto+'/';

form.on('fileBegin', function (name, file){

checkDirectorySync(path.join(__dirname, dir));
file.path = path.join(__dirname,dir,;

form.on('file', function (name, file){
console.log('Uploaded ' +;


Answer Source

This is a client-side issue, not a server issue because it is the client that determines how this works.

If you let the browser submit a form on its own (normal form post submission), then it will be expecting a response back from the POST that it will show in the browser. You cannot change that if it is an automatic form submission.

If you use an Ajax call to post the data to the server and you prevent the default form post, then the response comes back to your Javascript and you can do anything you want with the returned response (including nothing). The page contents will not change on their own.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download