File tree Expand file tree Collapse file tree 2 files changed +81
-0
lines changed Expand file tree Collapse file tree 2 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
6+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7+ < title > Document</ title >
8+
9+ < script src ="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js "> </ script >
10+ < script src ="js/script.js "> </ script >
11+
12+ < style >
13+
14+ * {
15+ margin : 0 ;
16+ padding : 0 ;
17+ box-sizing : border-box;
18+ font-family : inherit;
19+ }
20+
21+ body {
22+ display : flex;
23+ justify-content : center;
24+ align-items : center;
25+ height : 100vh ;
26+
27+ background-color : blanchedalmond;
28+ font-family : sans-serif;
29+ }
30+
31+ ul {
32+ width : 300px ;
33+ }
34+
35+ ul li {
36+ list-style : none;
37+ margin : 5px 0 ;
38+ }
39+
40+ </ style >
41+ </ head >
42+ < body >
43+ < ul id ="target "> </ ul >
44+ </ body >
45+ </ html >
Original file line number Diff line number Diff line change 1+ function printList ( ) {
2+
3+ for ( let i = 0 ; i < 10 ; i ++ ) {
4+
5+ getMail ( ) ;
6+ }
7+ }
8+
9+ function getMail ( ) {
10+
11+ $ . ajax ( {
12+
13+ url : 'https://flynn.boolean.careers/exercises/api/random/mail' ,
14+
15+ method : 'GET' ,
16+
17+ success : function ( data ) {
18+
19+ // console.log(data);
20+
21+ const target = $ ( "#target" ) ;
22+ target . append ( `<li>${ data . response } </li>` ) ;
23+ } ,
24+
25+ error : function ( ) {
26+
27+ }
28+ } )
29+ }
30+
31+ function init ( ) {
32+
33+ printList ( ) ;
34+ } ;
35+
36+ document . addEventListener ( 'DOMContentLoaded' , init )
You can’t perform that action at this time.
0 commit comments