【无标题】ikun宝地

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button class="check">用户验证</button>
    <button class="register">用户注册</button>
    <!-- 下载 导入 -->
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <script>
        // 测试接口:https://gitee.com/westblueflower/testApi#%E7%94%A8%E6%88%B7
        // 用户验证

        document.querySelector('.check').onclick = function () {

            // 发起请求,校验帐号可用性
            axios.post('https://autumnfish.cn/api/user/check', { username: 'thinker' }).then(function (res) {
                console.log(res);
            })
        }
        
        // 用户注册
        document.querySelector('.register').onclick = function () {

            // 发起请求,进行用户注册
            axios.post('https://autumnfish.cn/api/user/register', { username: 'thinker' }).then(function (res) {
                console.log(res);
            })
        }
    </script>
</body>

</html>

 

猜你喜欢

转载自blog.csdn.net/m0_60505147/article/details/126968722