将提交输入保存到单独的txt文件

时间:2018-03-29 15:19:45

标签: javascript html

我有几个生成数组的 select tags 。到目前为止,我只是在按提交按钮时在控制台上记录数组,但现在我想将它们保存在单独的文本文件上。

我的main.html:

 <form method="POST" action="/submit">
         <select name="rank" size="1" required >
                    <option value="" selected disabled hidden>Rank</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                  </select>
  <div class="submit-holder">
        <input type="submit" value="Submit" name="submit" id="submit"/>
  </div>
 </form>

我的app.js:

app.post('/submit', function(req, res){
 console.log(req.body.rank);
});

非常感谢您提前!

1 个答案:

答案 0 :(得分:1)

使用blobFileServer.js when(QUEUED, matchEvent(Exception.class, Service.class, (exception, dservice) -> goTo(ERROR) .replying(ERROR))); // TODO:It seems missing from the DOC that to transition from a state , every state must be // listed // a service is in a errored state when(ERROR, matchAnyEvent((state, data) -> stay().replying("Staying in Errored state"))); onTransition(matchState(QUEUED, ERROR, () -> { // Update the Service object and save it to the database })); 来查看此数据以保存数据:https://redstapler.co/generate-text-file-javascript/