Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title> INSERT TITLE </title>
  6. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
  7.  
  8. <style>
  9. #topbar p {
  10. display: inline-block;
  11. float: left;
  12. margin-right: 50px;
  13. margin-left: 50px;
  14. }
  15.  
  16.  
  17. </style>
  18. </head>
  19.  
  20. <body>
  21.  
  22. <div id = "topbar">
  23. <p id = "home"> Home </p>
  24. <p id = "table"> Table </p>
  25. <p id = "quiz"> Quiz </p>
  26. <p id = "flags"> Flags </p>
  27. </div>
  28. <br><br><br><hr>
  29.  
  30. <!--JSON-->
  31. <script>
  32.  
  33. $(function() {
  34.  
  35.  
  36. var countries = [];
  37.  
  38. $.getJSON('countries.json', function(data) {
  39. $.each(data.countries, function(i, f) {
  40. var tblRow = "<tr>" + "<td>" + f.name + "</td>" + "<td>" + f.capital + "</td>" + "<td>" + f.currency + "</td>" + "</tr>"
  41. $(tblRow).appendTo("#countries tbody");
  42. });
  43.  
  44. });
  45.  
  46. });
  47. </script>
  48.  
  49. <table id="countries">
  50. <thead>
  51. <th>Name</th>
  52. <th>Capital</th>
  53. <th>Currency</th>
  54. </thead>
  55.  
  56. <tbody>
  57.  
  58. </tbody>
  59. </table>
  60.  
  61. </body>
  62. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement