2016-07-21 7 views
0

EJSEjsフォームアクションがノードjsで動作していませんか?

<h4 style="display: inline">You are Connected to:</h4> 
      <u style="display: inline"><%= host %>:<%= port%> </u> 
     </br> </br> 
     <h4 style="display: inline">Output is:</h4> 
     <u style="display: inline"><%= temp %> </u> </br> 
     </section> </br> 
     <label> Click on graph for live updated graph! </label> 
     </br></br> 
     <button type="submit" formaction="/" formmethod="get" style="width: 8em;">Clear</button> 
     </br> </br> 

ノードのjs

app.post('/output3', function(req, res){ 
client.once('message', function (message) { 
     var temp = message.toString(); //here you assign temp variable with needed value 
     res.render('index', {temp:temp, host: HOST, port: PORT}) 
    }); 
}); 

app.get('/', function(req, res){ 
    res.sendFile(__dirname + '/upload2.html') 
}); 

私はクリアボタンを押すと、私はupload2.htmlする取得したいです。しかし、今、私がボタンを押すと、何も起こらないのですか?何か案が??

答えて

0

私の知る限りでは、formactionオーバーライドあなたはボタンが含まれている<form>要素を持っている必要があることを意味している現在のフォームのaction、:

<form> 
    <button type="submit" formaction="/" formmethod="get" style="width: 8em;">Clear</button> 
</form> 

(Chromeでテストしました)
関連する問題