I have a form tag in Html like then:
app.get("/",(req,res)=>{
res.sendFile(__dirname+"/index.html")
})
app.post("/Cong",urlencodedParser,(req,res)=>{
var a = parseInt(req.body.a);
var b = parseInt(req.body.b);
var c = a + b;
res.send("Result: "+c)//This is will route to a new website, but I just want change text in my HTML
})
<form action="/Cong" method="post">
A: <input type="text" name="a"><br>
B: <input type="text" name="b"><br>
<label id="result"></label>
</form>
how I can change the label in HTML with id result = value C in file js when I click the button.
Aucun commentaire:
Enregistrer un commentaire