[Answer]-How to create HTML for django objects after AJAX?

1👍

You need to add some html tags to your content like this:

<ul class="content">
{% for obj in objects %}
    <li>{{obj.attr1}}, {{obj.attr2}}</li>
{% endfor %}
</ul>

then use jQuery to append new object:

$('.content').append('<li>' + data.attr1 + ', '+ data.attr2 + '</li>');

data is the response object.

Leave a comment