Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 142a756

Browse files
Merge pull request #37 from AzharAli-github/main
fetch-API-II
2 parents 5a5396f + ed7a205 commit 142a756

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
4.15 KB
Loading[フレーム]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Fetch API- Part-II</title>
9+
</head>
10+
11+
<body>
12+
<h1>Fetch API Part 2 from url</h1>
13+
<h2>Example</h2>
14+
<button onclick="DisplayOne()">Click</button>
15+
<p id="textOne"></p>
16+
<script src="script.js"></script>
17+
</body>
18+
19+
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Fetch API Part 2, Fetching From URL
2+
let textOne = document.getElementById('textOne');
3+
4+
function DisplayOne() {
5+
fetch('https://jsonplaceholder.typicode.com/todos/1')
6+
.then(response => {
7+
let resp = response;
8+
textOne.innerHTML = resp;
9+
console.log(textOne);
10+
});
11+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /