Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table class = "table">
- <tbody id = "list">
- <tr>
- <td>
- {% for msg in chat %}
- {{ msg.message }}
- {% endfor %}
- </td>
- </tbody>
- </table>
- <script>
- $(document).ready(function () {
- var list = $('#list');
- $.ajax({
- method: 'POST',
- url: '/ajax/',
- data: {id: list},
- success: function(data){
- $.each(JSON.parse(msg['data']), function (i, item) {
- var td = document.createElement('td');
- var text = document.createTextNode( item.message);
- td.appendChild(txt);
- list.appendChild(td);
- });
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement