<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div>Hello Cangjie!</div>
<p></p>
<script>
let xhr = new XMLHttpRequest()
xhr.open("POST", "/Hello", true)
xhr.onreadystatechange = () => {
if(xhr.readyState == 4 && xhr.status == 200){
let res = JSON.parse(xhr.responseText)
document.body.innerHTML += `<div>${res.msg}</div>`
}
}
xhr.send(JSON.stringify({
name: "Chen",
age: 999
}))
</script>
</body>
</html>