Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <style>
- table, th, td {
- border: 1px solid black;
- }
- </style>
- <title></title>
- </head>
- <body>
- <ul id="users"></ul>
- <script src="https://unpkg.com/axios@0.21.1/dist/axios.min.js"></script>
- <script>
- axios.get('https://jsonplaceholder.typicode.com/users')
- .then(function (res) {
- res.data.forEach(x => {
- document.getElementById('users').innerHTML +=
- '<table border="1" >'+
- '<tr >'+
- '<th>'+ 'Name' + '</th>' +
- '<th>' + 'Username' + '</th>' +
- '<th>' + 'Email' + '</th>' +
- '<th>' + 'Phone Numner' + '</th>' +
- '</tr>' +
- '<tr >'+
- '<td>'+ x.name + '</td>'+
- '<td>' + x.username + '</td>' +
- '<td>' + x.email + '</td>' +
- '<td>' + x.phone + '</td>' +
- '</tr>' + '<br>' +
- '</table> '
- ;
- });
- })
- .catch(function(err){
- console.log(err);
- })
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement