从按钮POST请求

时间:2018-05-15 22:48:13

标签: javascript html node.js express

我遇到了问题,我正在尝试从按钮发布数据。这是我的代码:

 <% parsedData["Search"].forEach(function(movie){ %>
<div class="card" style="width: 18rem;">
  <img class="card-img-top" src="<%= movie.Poster %>" alt="<%= movie.Title %> Poster">
  <div class="card-body">
    <h5 class="card-title"><%= movie.Title %> </h5>
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <form action="/results" method="POST"> 
      <button class="btn btn-primary btn-sm" type="submit">Add</button>
    </form>
    <a href="#" class="btn btn-primary btn-sm">Go somewhere</a>
  </div>
</div>
<% }); %>

我想将movie.Title和movie.Poster的值传递给/ results而不必通过输入来完成,所以当用户点击按钮时,电影元数据会被发送到POST请求/结果

0 个答案:

没有答案
相关问题