Skip to content

Commit

Permalink
Merge pull request #2 from gablon29/nueva
Browse files Browse the repository at this point in the history
FirstApi
  • Loading branch information
gablon29 authored Aug 16, 2022
2 parents bbe2ff5 + 69183c7 commit 5f1752c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ProJsApis/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="app"></div>
<script src="index.js" type="module"></script>
</body>
</html>
37 changes: 37 additions & 0 deletions ProJsApis/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const API_URl = 'https://jsonplaceholder.typicode.com';

const HTMLResponse = document.querySelector("#app");
const ul = document.createElement('ul');

fetch(`${API_URl}/users`)
.then((response) => response.json())
.then((users) => {
users.forEach(user => {
let elem = document.createElement('li');
elem.appendChild(document.createTextNode(`${user.name} 💌 ${user.email}`))
ul.appendChild(elem);
})

HTMLResponse.appendChild(ul);

// const tpl = users.map((user) => `<li>${user.name} 💌 ${user.email}</li>`);
// HTMLResponse.innerHTML = `<ul>${tpl}</ul>`;
})


// const xhr = new XMLHttpRequest();

// function onRequestHandler() {
// if(this.readyState === 4 && this.status === 200){
// const data = JSON.parse(this.response);
// const HTMLResponse = document.querySelector("#app");

// const tpl = data.map(user => `<li>${user.name} 💌 ${user.email}</li>`);


// HTMLResponse.innerHTML = `<ul>${tpl}</ul>`;
// }
// }
// xhr.addEventListener('load', onRequestHandler)
// xhr.open('GET', `${API_URl}/users`);
// xhr.send();
2 changes: 1 addition & 1 deletion Robot/nuevP.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
</div>
</nav>

<h1> Comision 5I</h1>
<h1>Comision 5I</h1>

<!--aqui comienza el carousel-->

Expand Down

0 comments on commit 5f1752c

Please sign in to comment.