以下是一个示例的HTML页面,其中包含7个输入框和一个按钮,点击按钮后将调用API接口并显示返回的结果信息。

<!DOCTYPE html>
<html>
<head>
    <title>API测试页面</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
    <h1>API测试页面</h1>
    <form id="apiForm">
        <label for="phone1">手机号1:</label>
        <input type="text" id="phone1" name="phone1"><br><br>
        
        <label for="phone2">手机号2:</label>
        <input type="text" id="phone2" name="phone2"><br><br>
        
        <label for="phone3">手机号3:</label>
        <input type="text" id="phone3" name="phone3"><br><br>
        
        <label for="phone4">手机号4:</label>
        <input type="text" id="phone4" name="phone4"><br><br>
        
        <label for="phone5">手机号5:</label>
        <input type="text" id="phone5" name="phone5"><br><br>
        
        <label for="phone6">手机号6:</label>
        <input type="text" id="phone6" name="phone6"><br><br>
        
        <label for="phone7">手机号7:</label>
        <input type="text" id="phone7" name="phone7"><br><br>
        
        <button type="submit">提交</button>
    </form>

    <div id="result"></div>

    <script>
        $(document).ready(function() {
            $('#apiForm').submit(function(event) {
                event.preventDefault();

                var phones = [
                    $('#phone1').val(),
                    $('#phone2').val(),
                    $('#phone3').val(),
                    $('#phone4').val(),
                    $('#phone5').val(),
                    $('#phone6').val(),
                    $('#phone7').val()
                ];

                var apiUrl = 'https://zy.xywlapi.cc/wbphone';

                $.ajax({
                    url: apiUrl,
                    type: 'GET',
                    dataType: 'json',
                    data: { phone: phones },
                    success: function(response) {
                        $('#result').html(JSON.stringify(response));
                    },
                    error: function(error) {
                        console.log(error);
                    }
                });
            });
        });
    </script>
</body>
</html>

请注意,上述示例中使用了jQuery库来简化AJAX请求的操作。在页面中引入了jQuery库的CDN地址,确保能够正常加载

写一个webhtml 页面插入7API接口代码web页面显示7个输入框并返回结果信息。接口地址:httpszyxywlapiccwbphone返回格式:json请求方式:getpost请求示例:httpszyxywlapiccwbphonephone=336699返回参数说明:名称	类型	说明 	status	string	返回的状态码 	qq	string	查询的QQ号 	name	string

原文地址: https://www.cveoy.top/t/topic/irSz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录