-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
sendmessage.html
50 lines (45 loc) · 1.46 KB
/
sendmessage.html
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!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>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="main-container">
<h1>Twilio doesn't support sending messages to unverified Numbers from trial account
</h1>
<div class="container">
<h3>Enter Message</h3>
<input id="msg" type="text">
<h3>Enter Phone Number</h3>
<input id="num" type="text">
<br><br>
<div class="btn-container">
<button id="btn_submit">Submit</button>
</div>
</div>
</div>
</body>
<script>
const submit = () => {
let msg = document.getElementById("msg").value
let num = document.getElementById("num").value
let body = { sendTo: num, messageBody: msg }
fetch('http://localhost:3000/api/sendMessage', {
method: 'POST',
// mode: 'no-cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
})
.then(res => console.log(res))
.catch(err => console.log(err))
console.log(document.getElementById("msg").value);
}
document.getElementById("btn_submit").addEventListener("click", submit);
</script>
</html>