i wanted to display a message in html page after submiting the data, wether it is correct or not on the same html page, till now i can only do is show the message on new page.
below is the node code
app.post('/login',(req,res)=>{
try{
console.log(req.body)
if(req.body.yourname!='mohit')
res.send('Content-Type' )
else
res.send('thankyou for submission')
}catch(error){
res.send()
}
})
app.listen(port,()=>{
console.log('server started to'+port);
})
Below is the html code
<div class="container">
<form id="contact" action="/login" method="post">
<h3>Contact Form</h3>
<fieldset>
<input name="yourName" placeholder="Your name" type="text" tabindex="1" required autofocus>
</fieldset>
<fieldset>
<input name="Email" placeholder="Your Email Address" type="email" tabindex="2" required>
</fieldset>
<fieldset>
<input name="Phone" placeholder="Your Phone Number (optional)" type="tel" tabindex="3" required>
</fieldset>
<fieldset>
<input name="site" placeholder="Your Web Site (optional)" type="url" tabindex="4">
</fieldset>
<fieldset>
<textarea name="Message" placeholder="Type your message here...." tabindex="5"></textarea>
</fieldset>
<fieldset>
<button name="submit" type="submit" id="contact-submit">Submit</button>
</fieldset>
</form>
help would be really appricated?