Wednesday, 26 April 2017

Why doesn't this function return req.body.parameters?

I have the following API call when a button is clicked:

app.get('/api/sign-in', function(req, res, next) {
 console.log(req.body.email)
 console.log(req.body.password)
})

And the JavaScript on the client side:

$("button").on('click', function(event) {
event.preventDefault();
$.ajax({
url: '/api/sign-in',
method: 'POST',
data: {
email: $('#email').val(),
password: $('#password').val()
}
});
});

Why is it that my console logs NOTHING when I click on the button?



via kupak12

No comments:

Post a Comment