0
由於某種原因,我無法發送/接收POST數據。我試圖簡單地console.log發佈數據在/保存路線我錯過了什麼?Node.js/Express POST數據未發送
index.jade:
extends layout
block content
div#startbutton
p start
div#endbutton
p stop
div#resetbutton
p reset
div#savebutton
p save
div#container
form(name='textform', method='post', action='/save')
input(type="submit", value="Submit")
textarea#thetextarea(rows=20 cols=30)
路線:
var express = require('express');
var bodyParser = require('body-parser');
var router = express.Router();
router.use(bodyParser.urlencoded({ extended: false }));
router.use(bodyParser.json());
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Recorder Prototype' });
});
router.post('/save', function(req, res, next) {
console.log(req.body.thetextarea);
console.log(req.body);
console.log("=============================");
res.render('data', { title: 'Save', textstring: req.body.thetextarea });
});
module.exports = router;
HAHAH OMG。謝謝。 – andehlu