File tree 2 files changed +24
-2
lines changed 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 445
445
// // async await
446
446
447
447
// // fetch api
448
+ document . getElementById ( 'button1' ) . addEventListener ( 'click' , getText )
449
+
450
+ function getText ( ) {
451
+
452
+ console . log ( 'getText called' ) ;
453
+ fetch ( 'data.txt' ) . then ( function ( res ) {
454
+ console . log ( res . text ( ) )
455
+ } )
456
+
457
+ }
458
+
459
+
448
8000
code>
460
449
461
// // arrow function
450
462
Original file line number Diff line number Diff line change 10
10
11
11
<!-- Compiled and minified CSS -->
12
12
< link rel ="stylesheet " href ="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css ">
13
-
13
+ < script src =" Ajax.js " > </ script >
14
14
<!-- Compiled and minified JavaScript -->
15
15
< script src ="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js "> </ script >
16
16
@@ -126,9 +126,19 @@ <h2>TOdos </h2>
126
126
</ div >
127
127
</ div >
128
128
129
+
130
+ < div class ="container ">
131
+ < div class ="readFile ">
132
+ < button type ="button " id ="button1 " class ="btn btn-outline-success "> Get Text Data</ button >
133
+ < button type ="button " id ="button2 " class ="btn btn-outline-success "> Get JSON</ button >
134
+ < button type ="button " id ="button4 " class ="btn btn-outline-success "> Get API Data</ button >
135
+ < div id ="output "> </ div >
136
+ </ div >
137
+ </ div >
138
+
129
139
< script src ="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js "> </ script >
130
140
< script src ="myHttp.js "> </ script >
131
- < script src =" Ajax.js " > </ script >
141
+
132
142
133
143
</ body >
134
144
You can’t perform that action at this time.
0 commit comments