-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhost.html
More file actions
35 lines (34 loc) · 1.02 KB
/
host.html
File metadata and controls
35 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>هوش مصنوعی</title>
</head>
<body>
<center>
<h1>هوش مصنوعی</h1>
<p>خوش آمدید! لطفا سؤال خود را وارد کنید</p>
<input type="text" id="soal" placeholder="سؤال خود را وارد کنید">
<button onclick="send()">بپرس</button>
<p id="res"></p>
</center>
<script>
function send() {
var soal = document.getElementById("soal").value;
document.getElementById("res").innerHTML = "کمی صبر کنید...";
var xhr = new XMLHttpRequest();
var url = "https://mrapiweb.ir/ai/?text=" + encodeURIComponent(soal);
xhr.open('GET', url, true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
var response = xhr.responseText;
document.getElementById("res").innerHTML = response;
}
};
xhr.send();
}
</script>
</body>
</html>