JSFiddle - React, Tailwind, and code Playground
by ajmeese7
HTML
<button class="sign_upBtn">
Sign Up
</button>
JavaScript
$('.sign_upBtn').on('click', async function() {
const name = $('.nameCon input').val()
const username = $('usernameCon input').val()
const password = $('.passwordCon input').val()
const result = await fetch('/api/user/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": name,
"username": username,
"password": password
})
}).then((res) => res.json())
console.log(result)
})