节点JS有不同的按钮

时间:2017-06-16 04:17:24

标签: node.js

我正在玩一个页面,我正在尝试使用3个按钮,这些按钮都做了类似的事情,但添加了一个不同的" fa fa-tag"发布到页面时。

所以如果有人点击了"列表"他们输入数据后按钮会将其贴在" fa fa-flag"而不是" fa fa-tag"。 如果他们点击“购买”按钮,则会发布一个" fa fa-tags" 和卖出会发布" fa fa-tag"

.html按钮

    <button type="button" id="New_Listing_Button"> Listing </button>

    <button type="button" id="New_sell_Button"> Sell </button>

    <button type="button" id="New_buy_Button"> Buy </button>

.HTML数据字段

&#13;
&#13;
.
&#13;
&#13;
&#13;

<div id="Popup_Background" class="hidden"></div>
<div id="Dialog_Window" class="hidden">
<div class="Dialog">

  <div class="Window_Header">
    <a href="#"><h3 class="Window_Title"> Yard Sales </h3> </a>
    <button type="button" class="Close_Button">&times;</button>
  </div>

  <div class="Window_body">
    <div class="input_element">
      <label for="text_input">Description</label>
      <textarea id="text_input"><`enter code here`/textarea>
    </div>
    <div class="input_element">
      <label for="Date_Input">When Or $ </label>
      <input type="text" id="Date_Input">
    </div>

    <div class="input_element">
      <img for="Img_URL">URL</img>
      <input type="url" id="Img_URL" placeholder="not working">
    </div>
  </div>

  <div class="Window_Footer">
    <button type="button" class="Window_Cancel_Button">Cancel</button>
    <button type="button" class="Window_Accept_Button">Post</button>
     </div>
   </div>
  </div>

 </div>

.nodejs代码

    app.post('/posts/addListing', function (req, res, next) {
  var posts = postData
  var posting = {

    text: req.body.text,
    amount: req.body.amount,
    imgUrl: req.body.imgUrl,

  };

感谢您提供任何帮助

0 个答案:

没有答案