Skip to content

Instantly share code, notes, and snippets.

Avatar

Kesara Wimal kesarawimal

View GitHub Profile
@kesarawimal
kesarawimal / jquery.js
Last active Feb 15, 2021
FormSubmit AJAX Documentation: jQuery
View jquery.js
// 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"
},
@kesarawimal
kesarawimal / fetch.js
Last active Feb 15, 2021
FormSubmit AJAX Documentation: Fetch
View fetch.js
// 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"
@kesarawimal
kesarawimal / axios.js
Last active Feb 15, 2021
FormSubmit AJAX Documentation: Axios
View axios.js
// 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));
View dabblet.css
@import url("https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css");
h1 {
text-align: center;
margin: 35px 0 20px 0 !important;
}
View findone.ts
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) {