如何使用发布请求将表html发送到节点js

时间:2019-12-07 00:23:14

标签: jquery html node.js ajax

我想要做的是使用express将信息从html表发送到节点js,当我打印“ req.body”时,看起来好像没用。

app.js

const express = require('express');
const bodyParser = require('body-parser');

app.post('/services/add-registration', function(req, res){
    console.log(req.body);
});
inde.html

<table class="table">
   <thead class="thead-dark">
      <tr>
        <th scope="col">id</th>
        <th scope="col">Description</th>
        <th scope="col">Amount</th>
      </tr>
   </thead>
   <tbody>
      <tr>
        <td>1</td>
        <td>Product 1</td>
        <td>100.00</td>
      </tr>
      <tr>
        <td>2</td>
        <td>Product 2</td>
        <td>50.00</td>
      </tr>
   </tbody>
</table>

0 个答案:

没有答案