Cant seem to get CSS working on an appended table

Posted by battlenub on Stack Overflow See other posts from Stack Overflow or by battlenub
Published on 2013-10-22T21:11:31Z Indexed on 2013/10/22 21:54 UTC
Read the original article Hit count: 244

Filed under:
|

I have an ajax request to a php file returning me rows of 3 values each.

I want to append these into a table. This works. I get my info in my table but I can't seem to add classes or id's and get some styling on it.

http://jsfiddle.net/AKh4n/1/

success : function(data) {
                        $('#lijstbeh').empty();

                        var data2 = jQuery.parseJSON(data);
                        $('#lijstbeh').append('<table class="table">');
                        $('#lijstbeh').append('<tr>');
                        $('#lijstbeh').append('<th>Behandeling ID</th>');
                        $('#lijstbeh').append('<th>Behandeling kort</th>');
                        $('#lijstbeh').append('<th>Behandeling datum</th>');
                        $('#lijstbeh').append('</tr>');

                        $.each (data2,function (bb)
                        {
                            $('#lijstbeh').append('<tr class="tblbehandelingen">');
                            $('#lijstbeh').append('<td>' + data2[bb].BEH_ID + '</td>');
                            $('#lijstbeh').append('<td>' + data2[bb].BEH_behandelingkort + '</td>');
                            $('#lijstbeh').append('<td>' + data2[bb].BEH_datum + '</td>');
                            $('#lijstbeh').append('</tr>');
                        });

                        $('#lijstbeh').append('</table>');

                    }

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery