"Dynamic Buzy Indicator in Table"
Bootstrap 3.3.0 Snippet by tanveer12332

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"/> <div class="container"> <div class="row"> <div class="col-sm-12"> <h2>Table with Ajax Call Back</h2> <table class="table table-bordered table-condensed table-striped"> <thead> <tr> <th>Heading 1</th> <th>Heading 2</th> <th>Heading 3</th> <th class="text-center">Action</th> </tr> </thead> <tbody> <tr> <td>Data 1</td> <td>Data 1</td> <td>Data 1</td> <td class="text-center"><button class="btn btn-danger" onclick="myFunction(1)"><i class="fa fa-refresh fa-spin fa-fw hide"></i> Action</button></td> </tr> </tbody> </table> <!-- <div id="applendData"></div>--> <table class="table table-bordered table-condensed table-striped" id="applendData"> <caption>Dynamic Table with json.</caption> <thead> <tr> <th>First Name</th> <th>Last Name</th> <th>Gender</th> <th>Street</th> <th>City</th> <th>Email</th> </tr> </thead> <tbody> </tbody> </table> </div> </div> </div>
function myFunction(id){ var self=$(this); var icon=$('i.hide'); self.each(function(){ icon.removeClass('hide').parent().addClass('disabled'); $.ajax({ url: 'https://randomuser.me/api/', dataType: 'json', success: function(data){ for(var i=0;i<data.results.length;i++) { var name=data.results[i]['name']; var location=data.results[i]['location']; var html='<tr><td>'+ name.first + '</td><td>'+ name.last + '</td><td>'+data.results[0]['gender']+'</td><td>'+location.street+'</td><td>'+location.city+'</td><td>'+data.results[0]['email']+'</td></tr>'; $('table#applendData tbody').append(html); } icon.addClass('hide').parent().removeClass('disabled'); } }); }); };

Related: See More


Questions / Comments: