Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit ef74225

Browse files
added files
1 parent 6eea3aa commit ef74225

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

Week1/Images/dog.png

109 KB
Loading
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8" />
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
<title>Document</title>
6+
<script>
7+
const Http = new XMLHttpRequest();
8+
9+
const url = 'https://dog.ceo/api/breeds/image/random';
10+
Http.open('GET', url);
11+
Http.send();
12+
13+
const axios = require('axios').default;
14+
15+
axios
16+
.get('https://dog.ceo/api/breeds/image/random')
17+
.then((resp) => {
18+
console.log(resp.data);
19+
})
20+
.catch((err) => {
21+
// Handle Error Here
22+
console.error(err);
23+
});
24+
const image = document.createElement('img');
25+
var x = document.getElementById('img');
26+
27+
Http.onreadystatechange = (e) => {
28+
console.log(Http.responseText);
29+
};
30+
</script>
31+
</head>
32+
<body>
33+
<button type="button">Click Me!</button>
34+
<ul>
35+
<li><img src="dog.png" alt="A dog" />A dog</li>
36+
</ul>
37+
</body>
38+
</html>

0 commit comments

Comments
 (0)