Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.35 KB | None | 0 0
  1. <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  2. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  3. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  4. <script type="text/javascript">
  5.     var data = [
  6.   {
  7.     "UserID": 1,
  8.     "UserName": "rooter",
  9.     "Password": "12345",
  10.     "Country": "UK",
  11.     "Email": "sac@gmail.com"
  12.   },
  13.   {
  14.     "UserID": 2,
  15.     "UserName": "binu",
  16.     "Password": "123",
  17.     "Country": "uk",
  18.     "Email": "Binu@gmail.com"
  19.   },
  20.   {
  21.     "UserID": 3,
  22.     "UserName": "cal",
  23.     "Password": "123",
  24.     "Country": "uk",
  25.     "Email": "cal@gmail.com"
  26.   },
  27.   {
  28.     "UserID": 4,
  29.     "UserName": "nera",
  30.     "Password": "1234",
  31.     "Country": "uk",
  32.     "Email": "nera@gmail.com"
  33.   }
  34. ];
  35. $(document).ready(function () {
  36.     var html = '<table class="table table-striped">';
  37.     html += '<tr>';
  38.     var flag = 0;
  39.     $.each(data[0], function(index, value){
  40.         html += '<th>'+index+'</th>';
  41.     });
  42.     html += '</tr>';
  43.      $.each(data, function(index, value){
  44.          html += '<tr>';
  45.         $.each(value, function(index2, value2){
  46.             html += '<td>'+value2+'</td>';
  47.         });
  48.         html += '<tr>';
  49.      });
  50.      html += '</table>';
  51.      $('body').html(html);
  52. });
  53. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement