-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPI.html
More file actions
34 lines (32 loc) · 1.04 KB
/
API.html
File metadata and controls
34 lines (32 loc) · 1.04 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<p>
Ready states Properties
0 UNSENT Client has been created. open() not called yet.
1 OPENED open() has been called.
2 HEADERS_RECEIVED send() has been called, and headers and status are available.
3 LOADING Downloading; responseText holds partial data.
4 DONE The operation is complete.
</p>
</head>
<body style="background-color: #212121; color: rgb(243, 242, 242);">
<script>
const reqURL ='https://api.github.com/users/ShifaRabbani'
const xhr = new XMLHttpRequest()
xhr.open('GET' , reqURL)
xhr.onreadystatechange= function(){ //chngae continously
console.log(xhr.readyState);
if(xhr.readyState === 4){
const data= JSON.parse(this.responseText) //.parse convert srting to json
console.log( typeof data);
console.log(data.followers);
}
}
xhr.send()
</script>
</body>
</html>