Answer the question
In order to leave comments, you need to log in
Why can't I get data from the form?
There is this form:
<form method='post' action='/path'>
<input type='text' name='login' placeholder='Введите ник'><br>
<input type='password' name='pass' placeholder='Введите пароль'><br>
<input type='button' name='button' value='ОК' id='button'>
</form>
const express = require('express'),
bodyParser = require('body-parser'),
app = express();
app.use(bodyParser.urlencoded({extended: true}));
app.post('/path', (req, res) => {
console.log('Request')
console.log(req.body);
});
Answer the question
In order to leave comments, you need to log in
Hey! Your button does nothing. Change
<input type='button' name='button' value='ОК' id='button'>
on the<input type='submit' name='button' value='ОК' id='button'>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question