使用HTML与6.00chatgpt.com进行问答对话 - 示例代码
<!DOCTYPE html>
<html>
<head>
<title>6.00chatgpt.com问答对话</title>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
</head>
<body>
<h1>6.00chatgpt.com问答对话</h1>
<form>
<label for='userInput'>你的问题:</label>
<input type='text' id='userInput' name='userInput'><br><br>
<button type='submit' onclick='getResponse()'>提交</button>
</form>
<div id='response'></div>
<script>
function getResponse() {
var userInput = document.getElementById('userInput').value;
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('response').innerHTML = this.responseText;
}
};
xhttp.open('GET', 'https://6.00chatgpt.com/api/ask?question=' + userInput, true);
xhttp.send();
}
</script>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/ocj0 著作权归作者所有。请勿转载和采集!