I am trying to send some data to backend using ajax post request. Like this
$.ajax({
url: "/aa",
dataType: 'text',
type: 'post',
contentType: 'application/x-www-form-urlencoded',
data: input.value,
success: function (result) {
console.log("Success", input.value);
},
error: function (data) {
console.log(data);
}
});
but i when i want to print my bodys data like this i recieve undefined
console.log(requ.body.data);
i also use body parser in the backend
app.use(bodyParser.raw())
why it returns undefined?
2
Answers
this works, please tell me if you want me to create a fiddle
Controller:
View:
Hope this will work