-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevents.html
45 lines (44 loc) · 1.36 KB
/
events.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="card">
<img src="" alt="Avatar" style="width:100%">
<div class="container">
<h4></h4>
<p>Architect & Engineer</p>
</div>
</div>
<style>
.card {
/* Add shadows to create the "card" effect */
width: 500px;
height: 600px;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
}
.container {
padding: 2px 16px;
}
</style>
<script>
const api = "https://api.github.com/users/Samarpitjain";
const xml = new XMLHttpRequest();
xml.open('GET', api);
xml.onreadystatechange = function() {
if (xml.readyState === 4) {
console.log(xml.responseText);
const data = JSON.parse(xml.responseText);
document.querySelector(".card img").setAttribute("src" , `${data.avatar_url}`);
document.querySelector("h4").innerHTML = `${data.login} , Followers : ${data.followers}`;
document.querySelector("h4").style.fontWeight = `bold`;
}
}
xml.send();
</script>
</body>
</html>