【问题标题】:How to trigger a webpage in a post request in NodeJS?如何在 NodeJS 的 post 请求中触发网页?
【发布时间】:2020-08-17 07:00:40
【问题描述】:

下面是我要请求/zamansecimi之类的post方法的代码,我想根据/zamansecimi中的数据打开rapor.ejs之类的页面。

我该怎么做?

<form  method="post" action="/zamansecimi"  >
    <div class="form-group">
        <label for="ad">Başlangıç</label>
        <input type="date" class="form-control" name="baslangic" id="baslangic"  placeholder="" required>
    </div>
    <div class="form-group">
        <label for="soyad">Bitiş</label>
        <input type="date" class="form-control" name="bitis" id="bitis" placeholder="" required>
    </div>            
    <div class="box-footer">
        <button type="submit" value="rapor" class="btn btn-primary">Göster</button>
    </div>

      </div> 
   </div>
</form>

【问题讨论】:

    标签: html node.js post get


    【解决方案1】:

    当调用端点 (/zamansecimi) 时,您的后端需要以 redirect 响应。

    如果您使用的是express,您可以在此处查看文档https://expressjs.com/en/api.html#res.redirect

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-07
      • 2017-11-30
      • 2018-12-31
      • 2019-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多