Ok so i am trying to do is to a save a file to the user's disk when they click on it. Here is code, ajax:
 $('.cv_download').on('click',function(){
        var fileName = $(this).text();
        console.log(fileName)
        var temp = {"file" : fileName}
        console.log(temp);
        console.log(JSON.stringify(temp))
        $.ajax({
            url: '/download-cv-file',
            type: 'POST',
            data: {fileSend:JSON.stringify(temp)},
            dataType: 'json'
        });
    })
in my server file i have:
app.post('/download-cv-file', function(req, res){
    services.downloadFile(req,res);
});
which fires :
var downloadFile = function(req,res){
console.log('From services')
console.log(req.body.fileSend)
var p_file = JSON.parse(req.body.fileSend);
console.log(p_file);
console.log('The file we look for is ' + p_file.file);
var file = 'services/cvs/'+p_file.file+'';
console.log('The file is ' + file);
res.download(file);}
Any ideas? Thank you!
 
     
    