XEwRzv
A Pen by Kesara Wimal on CodePen.
A Pen by Kesara Wimal on CodePen.
User.findOne({ | |
name: req.body.name | |
}, function(err, user) { | |
if (err) throw err; | |
if (!user) { | |
res.json({ success: false, message: 'Authentication failed. User not found.' }); | |
} else if (user) { |
@import url("https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"); | |
h1 { | |
text-align: center; | |
margin: 35px 0 20px 0 !important; | |
} |
// https://github.com/axios/axios | |
axios.defaults.headers.post['Content-Type'] = 'application/json'; | |
axios.post('https://formsubmit.co/ajax/your@email.com', { | |
name: "FormSubmit", | |
message: "I'm from Devro LABS" | |
}) | |
.then(response => console.log(response)) | |
.catch(error => console.log(error)); |
// https://github.com/github/fetch | |
fetch("https://formsubmit.co/ajax/your@email.com", { | |
method: "POST", | |
headers: { | |
'Content-Type': 'application/json', | |
'Accept': 'application/json' | |
}, | |
body: JSON.stringify({ | |
name: "FormSubmit", | |
message: "I'm from Devro LABS" |
// https://api.jquery.com/jQuery.ajax | |
$.ajax({ | |
method: 'POST', | |
url: 'https://formsubmit.co/ajax/your@email.com', | |
dataType: 'json', | |
accepts: 'application/json', | |
data: { | |
name: "FormSubmit", | |
message: "I'm from Devro LABS" | |
}, |