Answer the question
In order to leave comments, you need to log in
How to transfer data to express and receive back?
Script on the client
$(document).ready(function() {
$('#submit').click(function() {
// вместо params будут данные с формы
var params = JSON.stringify({"name": "John", "date": "45"})
$.post("/123", params,
function(data){
alert(data);
});
});
});
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.post('/123', function(req, res) {
console.log(req.body);
res.send(req.body);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question