Advertisement
Nahid8195

Sultana fahim sp3

Jul 31st, 2021
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <style>
  5. table {
  6. font-family: arial, sans-serif;
  7. border-collapse: collapse;
  8. width: 100%;
  9. }
  10.  
  11. td, th {
  12. border: 1px solid #dddddd;
  13. text-align: left;
  14. padding: 8px;
  15. }
  16.  
  17. tr:nth-child(even) {
  18. background-color: #dddddd;
  19. }
  20. table, th, td {
  21. border: 1px solid black;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <ul id="users"></ul>
  27. <script src="https://unpkg.com/axios@0.21.1/dist/axios.min.js"></script>
  28. <script>
  29. axios.get('https://jsonplaceholder.typicode.com/users')
  30. .then(function (res) {
  31. res.data.forEach(x => {
  32. document.getElementById('users').innerHTML +=
  33. '<table border="1" >'+
  34. '<tr >'+
  35. '<th>'+ 'ID' + '</th>' +
  36. '<th>'+ 'Name' + '</th>' +
  37. '<th>' + 'Username' + '</th>' +
  38. '<th>' + 'Email' + '</th>' +
  39. '<th>' + 'Phone Numner' + '</th>' +
  40. '</tr>' +
  41. '<tr >'+
  42. '<td>'+ x.id + '</td>'+
  43. '<td>'+ x.name + '</td>'+
  44. '<td>' + x.username + '</td>' +
  45. '<td>' + x.email + '</td>' +
  46. '<td>' + x.phone + '</td>' +
  47. '</tr>' + '<br>' +
  48.  
  49.  
  50. '</table> '
  51.  
  52. ;
  53. });
  54. })
  55. .catch(function(err){
  56. console.log(err);
  57.  
  58. })
  59. </script>
  60.  
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement