Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JSON
- res = {
- "count": 5,
- "head": ["kode", "jenis"],
- "data": [{
- "001": "001",
- "1": "Dispenser"
- }, {
- "004": "004",
- "4": "DVD Player"
- }, {
- "005": "005",
- "5": "Kipas Angin"
- }, {
- "002": "002",
- "2": "Radio Tape"
- }, {
- "003": "003",
- "3": "Televisi"
- }]
- }
- jQuery
- items += '<tr>';
- $.each(res.head, function(kh, vh){
- items += '<th>'+vh+'</th>';
- });
- items += '</tr>';
- $.each(res.data, function(key,vals){
- items += '<tr>';
- $.each(vals, function(k, v){
- items += '<td data-value="'+k+'">'+v+'</td>';
- });
- items += '</tr>';
- });
- $(target).append(win);
- $('.searchContent').html('<table class="table table-bordered table-striped">'+items+'</table>').find('tbody tr:first').addClass('selected');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement