-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAufgabe 6.1 - Promisses.html
34 lines (32 loc) · 1.08 KB
/
Aufgabe 6.1 - Promisses.html
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
<html>
<body>
<h1>Promisses</h1>
<p></p>
<script>
console.log('test');
var file1 = fetch('A.txt');
var file2 = fetch('B.txt');
Promise.all([file1, file2])
.then((result) => {
var finalText = '';
return Promise.all([result[0].text(), result[1].text()]);
})
.then(result => {
[document.getElementsByTagName('p')].
forEach(e => {
textContent = result[0] + result[1];
console.log(result[0] + result[1]);
})
})
.catch(function( error ) {
console.log('Request failed ', error);
});
// function json(response) {
// return JSON.parse(response.json());
// }
function print(response){
console.log('response ', response.text());
}
</script>
</body>
</html>