[Fixed]-How can I show a formset in Django with a AJAX success function?

1👍

The template code doesn’t belong in the Ajax function. Apart from anything else, that code (presumably) is in an external JS function which isn’t parsed as a Django template; and, just as important, it doesn’t have access to any of the context from the updated POST.

What you should do is to get the Django view that is called by the Ajax to render a template and return that; then the success function only needs to insert the resulting HTML.

Leave a comment