使用API接口查询手机号信息 - 7个输入框的HTML页面示例
<!DOCTYPE html>
<html>
<head>
<title>API测试页面 - 查询7个手机号的QQ信息</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<h1>API测试页面 - 查询7个手机号的QQ信息</h1>
<form id="apiForm">
<label for="phone1">手机号1:</label>
<input type="text" id="phone1" name="phone1"><br><br>
<pre><code> <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>
</code></pre>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/p9ts 著作权归作者所有。请勿转载和采集!