1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| regBtn.onclick = function () { let userjson = { "id": input3.value, "password": input4.value }; const xhr = new XMLHttpRequest(); xhr.open('post', '/login'); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") xhr.send(userjson);
xhr.onreadystatechange = function () { if (xhr.readyState === 4) { if (xhr.status >= 200 && xhr.status < 300) { console.log(xhr.response); } } } }
|