-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
45 lines (36 loc) · 1.11 KB
/
index.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
console.log("This is my script")
let result = {
"tag": "",
"free": false,
"role": false,
"user": "akshaykumar",
"email": "akshaykumar@codewithharry.com",
"score": 0.64,
"state": "undeliverable",
"domain": "codewithharry.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!")
resultCont.innerHTML = `<img width="123" src="loading.svg" alt="">`
let key = "ema_live_ROzyhSt5Y8HvlRhgEryGqr8kAw7sGsAFTSJCy73m"
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
})