-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
44 lines (35 loc) · 1.14 KB
/
script.js
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
let result = {
"tag": "",
"free": true,
"role": false,
"user": "anu",
"email": "[email protected]",
"score": 0.48,
"state": "undeliverable",
"domain": "gmail.com",
"reason": "invalid_mailbox",
"mx_found": true,
"catch_all": null,
"disposable": false,
"smtp_check": false,
"did_you_mean": "",
"format_valid": true
}
submitBtn.addEventListener("click",async (e)=>{
e.preventDefault()
console.log("clicked on submit")
resultCont.innerHTML = ` <img width="45px" src="./img/loading.svg" alt="loading">`
let key = "ema_live_vAh1gYJzjjT7PX8KXXcoVRiQN0InodFRoZHxczao"
let email = document.getElementById("email").value
let url = `https://api.emailvalidation.io/v1/info?apikey=${key}&email=${email}`
let res = await fetch(url)
let result = await res.json()
let str = ``
for (key of Object.keys(result)){
if (result[key] !== "" && result[key]!== " ") {
str = str + `<div>${key}: ${result[key]}</div>`
}
}
console.log(str);
resultCont.innerHTML = str
})