-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
48 lines (44 loc) · 1.28 KB
/
index.html
File metadata and controls
48 lines (44 loc) · 1.28 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>XMLHTTPREQUEST</title>
</head>
<style>
body {
background-color: #212121;
color: #fff;
}
</style>
<body>
<h1>ajax programing</h1>
</body>
<script>
//Notes
//Ajax?=Asynchronous JavaScript And XML
//Ajax is a technique for creating fast and dynamic web pages.
// console and many api are not part of core js
//document are also not part of core js
// console.log is a debbuging tool of browser develpor tool..
//yh console.log browser ka run time inject krta he .
//v8 engine is js engine .. which is written in c++
//in v8 api there is communication between js and c++
// d8 folder must see line 104
// console.log(XMLDocument);
// console.log(XMLHttpRequest);
const requestUrl = "https://api.github.com/users/wcoder547";
const xhr = new XMLHttpRequest();
xhr.open("GET", requestUrl);
xhr.onreadystatechange = function () {
console.log(xhr.readyState);
if (xhr.readyState === 4) {
const data = JSON.parse(this.responseText);
console.log(typeof data); // string.. after json it will json
console.log(data.followers);
}
};
// console.log("HERE");
xhr.send();
</script>
</html>