forked from dhairyagothi/100_days_100_web_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
49 lines (36 loc) · 1.09 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
console.log("This is my script")
let result = {
"tag": "",
"free": true,
"role": false,
"user": "monishr6008",
"email": "[email protected]",
"score": 0.64,
"state": "deliverable",
"domain": "gmail.com",
"reason": "valid_mailbox",
"mx_found": true,
"catch_all": null,
"disposable": false,
"smtp_check": true,
"did_you_mean": "",
"format_valid": true
}
submitBtn.addEventListener("click", async (e) => {
e.preventDefault()
console.log("Clicked")
resultCont.innerHTML=`<img width="123" src="img/loading.svg" alt="">`
let key = "ema_live_tkRl4T1AMrlwioPCHxe8r1HmTSKkJSLehW9Ti42B"
let email = document.getElementById("username").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
})