router.post('/data', (req, res) => {
const text = req.body.text;
if (text) {
res.json({
ok: true
})
console.log(text)
} else {
res.json({
ok: false
})
}
});
<form method="POST" action="data">
<input type="text" class="body">
<button type="button" class="send">Send</button>
</form>
<script>
$('.send').on('click', (e) => {
let data = {
text: $('.body').val()
}
$.ajax({
type: 'POST',
data: JSON.stringify(data),
contentType: 'application/json',
url: '/data'
}).then(function (result) {
console.log(result['data']);
if (result.ok == true) {
console.log("Success!")
} else {
console.log('Error')
}
}).catch(function (err) {
console.log('err')
})
});
</script>
<main>
<div class="title">Why choose us?</div>
<div class="block">
<div class="container fcontainer">
<div class="image"><img src="img/01.svg" alt="icon"></div>
<div class="subtitle">Performance </div>
<div class="text">Torquem detraxit hosti et quidem se texit, ne ad. Lorem ipsum dolor sit amet consectetur
adipisicing elit. Quae, rerum.</div>
</div>
<div class="container">
<div class="image"><img src="img/02.svg" alt="icon"></div>
<div class="subtitle">Entrepreneurship</div>
<div class="text">Torquem detraxit hosti et quidem se texit, ne ad. Lorem ipsum dolor sit amet consectetur, adipisicing elit. Iste explicabo assumenda eum quae vitae dicta itaque aperiam ducimus id non provident illo perspiciatis cumque tempora accusantium excepturi suscipit, minus animi ab. Sint voluptates, impedit! lorem45</div>
</div>
<div class="container">
<div class="image"><img src="img/03.svg" alt="icon"></div>
<div class="subtitle">Authenticity</div>
<div class="text">Torquem detraxit hosti et quidem se texit, ne ad.</div>
</div>
<div class="container">
<div class="image"><img src="img/04.svg" alt="icon"></div>
<div class="subtitle">Kindness</div>
<div class="text">Torquem detraxit hosti et quidem se texit, ne ad.</div>
</div>
</div>
</main>
body {
/* font-family: "Gilroy", sans-serif; */
line-height: 1;
height: 100%;
font-size: 0px;
max-width: 1440px;
font-family: "Poppins";
}
/* --------------------- */
.block{
max-width: 1440px;
display: flex;
}
.container {
text-align: center;
}
.fcontainer{
padding-left: 165px;
}
.container:not(:last-child){
margin-right: 35px;
}
.title {
padding-top: 290px;
padding-bottom: 58px;
margin-left: 128px;
font-style: normal;
font-weight: 700;
font-size: 42px;
line-height: 1.48;
text-align: center;
letter-spacing: 0.8px;
color: #323232;
}
.image {
display: inline-block;
margin-bottom: 14px;
}
.subtitle {
font-style: normal;
font-weight: 700;
font-size: 28px;
line-height: 42px;
letter-spacing: 0.5px;
color: #323232;
}
.text {
margin-top: 2px;
font-style: normal;
font-weight: 400;
font-size: 16px;
line-height: 27px;
max-width: 248px;
letter-spacing: 1.15px;
color: #323232;
}