search

Home  >  Q&A  >  body text

html5 - Newbie’s question: Why can’t the post request of the form be processed by routing?

Front desk ws.html

<form method="post">  
    <p class="form-group" >
            <lable for="name">手机号</lable>
            <input type="text" class="form-control" id="name" placeholder="请输入你的手机号" name="pnum">
            <lable for="price">QQ号</lable>
            <input type="text" class="form-control" id="price" placeholder="请输入你的qq号" name="qnum">
            <lable for="num">邮箱</lable>
            <input type="text" class="form-control" id="num" placeholder="请输入你的邮箱" name="email">          
    </p>
    <button type="submit" class="btn btn-default">提交</button>
</form>

Routing ws.js

router.post('/ws',function(req,res,next){
    console.log(req,body);
    res.render('suc',{
       message : "恭喜你完善成功",
    })
})

迷茫迷茫2803 days ago843

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-06-10 09:51:12

    This route is not entered at all. Is your log information output?

    Your <form method="post"> does not have action, and it should post to the homepage of the website by default.

    reply
    0
  • Cancelreply