<input id="search"> <table border="1" BORDERCOLOR=black> <thead> <tr> <th>Name</th><th>LastName</th><th>E-Mail</th> </tr> </thead> <tbody id="theContent"> </tbody> </table> </body> <script type="text/javascript"> function loadUser(){ $.ajax({ url: 'users.ajax.php' }).done(function(data){ var HTML = ''; data = JSON.parse(data); $.each(data['usersData'], function(key, val){ HTML += getSingleUserLine(val); }); $('#theContent').html(HTML); $( '#search' ).keyup(function() { // need it to send the keyword here and refresh the results? alert( "Handler for .keyup() called." ); }); }); } function getSingleUserLine(data){ if(data){ var string = ''; string = '<tr><td>'+data.fname+'</td><td>'+data.lname+'</td><td>'+data.email+'</td></tr>'; return string; }else{ return false; } } $(document).ready(function(){ loadUser(); }); </script>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter