In recent versions of Express, the recommendation (passed through a debug message) is to stop using the bodyParser . I read a little, and it looks like bodyParser is a wrapper for json and urlencoded middlewares environments - and now, the most recent version of Express (3.4.4) uses these 2 instead of bodyParser out boxes - great, right?
But now I canβt get to my fields. req.body - undefined. Here is my JS form submission code (text fields only, no files). Can someone please tell me which req property / function to use to get the values?
var formData = new FormData($('#myForm')[0]); $.ajax({ url: '/myurl', cache: false, contentType: false, processData: false, data: formData, type: 'POST', success: function(data) { console.log(data); }, error: function(jqXHR, textStatus, errorThrown) { console.error('Error occured: ' + errorThrown); } });
source share