I am using dajax for ajax in my django app.
After getting some data from database I create list of <li>
elements in my python ajax.py and assign it with dajax to inner html of some container. Like this:
@dajaxice_register
def get_transactions(request):
dajax = Dajax()
transactions = get_transactions()
dajax.assign('#transactions', 'innerHTML', ''.join(transactions))
return dajax.json()
What is considered best practice? Returning html from server or returning json and then creating html in script?